Emanuel Berg | 18 May 2013 21:45
Picon
Picon
Favicon

Re: How to get hook var of the current major mode?

Dmitry Gutov <dgutov <at> yandex.ru> writes:

>> I want to do somthing like this:
>> (let ((hook (get--the--current--major--mode--hook)))
>>   (add-hook hook (lambda ()
>>                    (setq truncate-lines t))))
>
> ...And if the above form is run many times, each time a new lambda
> will be added to the hook.

When the hook fires, are all those lambda executed (doing the same
thing)?

--

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573

Barry Margolin | 18 May 2013 19:48
Picon
Favicon
Gravatar

Re: How to suppress/avoid *Async Shell Command* buffer?

In article <mailman.41.1368897044.22516.help-gnu-emacs <at> gnu.org>,
 Andreas Röhler <andreas.roehler <at> easy-emacs.de> wrote:

> Am 18.05.2013 16:37, schrieb Marius Hofert:
> > Hi Andreas,
> >
> > what do you mean by 'caused'?
> >
> > The question mark is a place holder for the file (foo.pdf).
> 
> Okay, see dired-do-shell-command reads it
> 
> > What does this have to do with *Async Shell Command* being opened?
> >
> 
> Nothing. It's the ampersand following ? which matters.
> 
> > Note: The behavior of "!" on foo.pdf in dired mode is fine (in the sense
> > that Okular opens, the pdf is shown, everything asynchronously), I just want
> > to avoid the buffer *Async Shell Command* being opened.
> >
> 
> Which seems the buffer Emacs connects the process to.
> Deleting it should end the processes, probably not a good idea.
> 
> So the ampersand seems the culprit - not the question mark.
> What happens when calling your stuff without it?

This is essentially the same as using M-!, isn't it, except that it 
automatically fills in the filename argument? If you don't use the 
(Continue reading)

Alan Mackenzie | 18 May 2013 18:26
Picon
Favicon

Re: formatting C++ code which includes SWIG macros

Hi, Doug.

Douglas Meyer <dbmeyer030 <at> gmail.com> wrote:
> Hi folks,

> I've entered into an existing project that is written in C++.

I think the problem is that it's _not_ C++, rather it's an idiosyncratic
extension, which (ab)uses the modulus operator to introduce a new type of
macro.

> The style is nearly the same as google-c-style.el, and so I'm using
> that with minor changes in emacs 23.1.1.

> The fly in the ointment are SWIG macros used in some C++ files. Since
> emacs apparently knows nothing about SWIG being used in other source
> files, the C++ formatting gets confused. Of course, this is because
> emacs is using what rules it has to interpret the code. No fault on
> emacs' part.

Presumably, there's some sort of preprocessor which converts these SWIG
files to standard C++ before they get to the compiler

> [If you're curious, I've put sketch of the kind of things I'm dealing
> with in the P.S.]

> I'm searching for a solution, and haven't yet found anybody who's
> already dealt with this. Unfortunately, I'm not a lisp writer.

Let me guess a few things about SWIG:
(Continue reading)

Wilfred Hughes | 18 May 2013 17:10
Picon
Gravatar

EIEIO defmethod broken if symbol already bound?

Hi folks

I think this might be an Emacs bug, but I'm not familiar enough with EIEIO
to be certain. Suppose I want to assign a method foo to a class some-class:

(require 'eieio)

(defclass some-class ()
  ((bar :initform 42)))

(defmethod foo ((s some-class))
  1)

This works fine. However, if the function definition of foo is already
bound to t, it doesn't work:

(require 'eieio)

(defclass some-class ()
  ((bar :initform 42)))

(defalias 'foo 't)

(defmethod foo ((s some-class))
  1) ;; Debugger entered--Lisp error: (void-function foo)

I'm forced to set foo to a function (e.g. (defalias 'foo 'method)) before I
can use (defmethod foo ...). In fact, calling M-x describe-function <RET>
foo <RET> says 'file a bug report'.

(Continue reading)

Barry Margolin | 18 May 2013 13:36
Picon
Favicon
Gravatar

Re: setenv and find-file

In article <mailman.27.1368871635.22516.help-gnu-emacs <at> gnu.org>,
 Peter Dyballa <Peter_Dyballa <at> Web.DE> wrote:

> Am 17.05.2013 um 23:07 schrieb Doug Lewan:
> 
> > I see a problem when M-x find-file is expanding ${VARIABLE} but not taking 
> > it from the newly defined environment variable. Everything else picks it up 
> > (I presume just via fork/exec).
> > 
> > I hope this script is clearer.
> > 
> > In shell:
> >    $ echo ${VARIABLE}
> >    /a/very/long/path
> >    $ emacs &
> > Inside emacs:
> >    C-x C-f ${VARIABLE}/to/work                <== Finds 
> >    "/a/very/long/path/to/work".
> >    (setenv "VARIABLE" "/shorter/path")
> >        => "/shorter/path"
> >    M-! echo ${VARIABLE}
> >    "/shorter/path"
> >    M-x shell
> > In shell inside emacs:
> >    $ echo ${VARIABLE}
> >    "/shorter/path"
> > Back in emacs:
> >    C-x C-f ${VARIABLE}/to/Grandmothers/house
> > This finds the file "/a/very/long/path/to/Grandmothers/house", where I sort 
> > of expect it to find "/shorter/path/to/Grandmothers/house".
(Continue reading)

Emanuel Berg | 18 May 2013 04:52
Picon
Picon
Favicon

Re: How to get hook var of the current major mode?

"netjunegg2 <at> gmail.com" <netjunegg2 <at> gmail.com> writes:

> I want to do somthing like this:
>
> (let ((hook (get--the--current--major--mode--hook)))
>   (add-hook hook (lambda ()
>                    (setq truncate-lines t))))

I don't know, but if you want for lots of modes an easier way would be:

(set-default 'truncate-lines 1)

--

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573

netjunegg2@gmail.com | 18 May 2013 11:48
Picon

How to get hook var of the current major mode?

I want to do somthing like this:
(let ((hook (get--the--current--major--mode--hook)))
   (add-hook hook (lambda ()
                    (setq truncate-lines t))))

Marius Hofert | 18 May 2013 02:03
Picon
Favicon

How to suppress/avoid *Async Shell Command* buffer?

Hi,

I use

--8<---------------cut here---------------start------------->8---
(setq dired-guess-shell-alist-user
      '(("\\.\\(?:pdf\\|djvu\\|jp?g\\)\\'" "okular ? &")
        ("\\.html\\'" "google-chrome ? &")))
--8<---------------cut here---------------end--------------->8---

to open pdf files in dired-mode via "!". Once I do this, my dired buffer
is vertically divided into two pieces by opening a buffer named
*Async Shell Command*. The buffer does not show anything. It is quite
useless and *very* tedious to close (not only for pdf files). How can I
suppress this buffer / avoid this buffer being opened?

Here is what I found on this topic:
1)
http://stackoverflow.com/questions/3679930/how-to-automatically-remove-or-prevent-popping-up-async-shell-command-in-ema
2)
http://stackoverflow.com/questions/6915314/emacs-automatically-close-async-output-buffers-on-command-completion3)
http://stackoverflow.com/questions/12083228/how-do-i-speed-up-emacs-output-from-an-asynchronous-shell-command
4) http://stackoverflow.com/questions/13348230/create-buffer-and-immediately-hide-it
5) http://stackoverflow.com/questions/7298372/run-a-program-from-emacs-and-dont-wait-for-output
6) https://groups.google.com/forum/?fromgroups#!topic/gnu.emacs.help/TNqE7R7mULk

1), 2), 3): idea with save-window-excursion
4), 5): idea with start-process
6): call-process-shell-command

(Continue reading)

Emanuel Berg | 17 May 2013 21:31
Picon
Picon
Favicon

Re: Abbrev in message-mode

Suvayu Ali <fatkasuvayu+linux <at> gmail.com> writes:

> Thanks a lot.  Could you also post the bug number so that I can
> follow it?  Thanks again.

No problem! (? - just a couple of keystrokes, but OK...)

Bug number: 14413

--

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573

dbmeyer030 | 17 May 2013 19:05
Picon

Problems formatting C++ with SWIG macros

Hi folks,

I've entered into an existing project that is written in C++. The team had previously agreed to abide by the
Google coding standard for the C++ work, but with a few changes, which I'm figuring out a little at a time and
making changes to google-c-style.el as I go.

But now I'm stuck because SWIG macros are used in some files.  Here's a fragment which is modeled on the kind of
thing I'm trying to resolve:

// Example.cc

1  #ifndef GUARD
2  #define GUARD
3
4  #include <something>
5
6  #ifdef SWIG
7
8  %define AMACRO( FIELD1, FIELD2 ) ... macro def ...
9  %enddef
10
11 #define SOMEOTHERMACRO SOMEOTHERDEFINITION
12
13 %define ANOTHERMACRO( ARG )
14    %extend ARG
15    {
16    ...
17    }
18  %enddef
19
(Continue reading)

Barry OReilly | 17 May 2013 18:24
Picon

How to achieve desired automatic scrolling behavior

For the most part, I want the behavior of scroll-conservatively 1, where
navigating line by line doesn't recenter, but jumping to a different part
of the buffer does.

One jarring behavior I wish to customize away is when going line by line
across a line that wraps visually, the behavior is to recenter. How do I
have it not recenter in this case?

Also desirable is when scroll-conservatively==1 would cause a recenter, it
would instead use the scroll-*-aggressively setting. Setting both of these
does not have that effect.


Gmane