all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* line length control setting
@ 2003-11-06 11:24 Adam Hardy
  0 siblings, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-06 11:24 UTC (permalink / raw)


Hi All,
I am using a brute force method of stopping myself from writing long 
lines of code, using this in my .emacs:

(defun my-dont-insert-after-fill-column (&rest x)
   (when (> (current-column)
            fill-column)
     (delete-char -1)
     (beep)))

(add-hook 'after-change-functions 'my-dont-insert-after-fill-column)

But I discovered this is also acting on the command buffer, so I cannot 
add more than my fill column when doing simple file copies or renames or 
text search & replaces.

Is there a way that I can adapt my function above to stop it applying to 
the command buffer?

Thanks
Adam

-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found] <mailman.3297.1068117967.21628.help-gnu-emacs@gnu.org>
@ 2003-11-06 15:41 ` Jesper Harder
  2003-11-06 18:27 ` Kevin Rodgers
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Jesper Harder @ 2003-11-06 15:41 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> I am using a brute force method of stopping myself from writing long
> lines of code, using this in my .emacs:
>
> (defun my-dont-insert-after-fill-column (&rest x)
>    (when (> (current-column)
>             fill-column)
>      (delete-char -1)
>      (beep)))
>
> (add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
>
> But I discovered this is also acting on the command buffer, so I
> cannot add more than my fill column when doing simple file copies or
> renames or text search & replaces.

Have you considered using `auto-fill-mode' instead?  This also works
quite well in programming-language modes.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found] <mailman.3297.1068117967.21628.help-gnu-emacs@gnu.org>
  2003-11-06 15:41 ` line length control setting Jesper Harder
@ 2003-11-06 18:27 ` Kevin Rodgers
  2003-11-07 13:57   ` Adam Hardy
  2003-11-07 18:40 ` Gareth Rees
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Kevin Rodgers @ 2003-11-06 18:27 UTC (permalink / raw)


Adam Hardy wrote:

> Hi All,
> I am using a brute force method of stopping myself from writing long 
> lines of code, using this in my .emacs:
> 
> (defun my-dont-insert-after-fill-column (&rest x)
>   (when (> (current-column)
>            fill-column)
>     (delete-char -1)
>     (beep)))
> 
> (add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
> 
> But I discovered this is also acting on the command buffer, so I cannot 
> add more than my fill column when doing simple file copies or renames or 
> text search & replaces.
> 
> Is there a way that I can adapt my function above to stop it applying to 
> the command buffer?

(when (and (not (eq major-mode 'shell-mode))

	   (> (current-column) fill-column))
   ...)


-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-06 18:27 ` Kevin Rodgers
@ 2003-11-07 13:57   ` Adam Hardy
  0 siblings, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-07 13:57 UTC (permalink / raw)


On 11/06/2003 07:27 PM Kevin Rodgers wrote:
>> I am using a brute force method of stopping myself from writing long 
>> lines of code, using this in my .emacs:
>>
>> (defun my-dont-insert-after-fill-column (&rest x)
>>   (when (> (current-column)
>>            fill-column)
>>     (delete-char -1)
>>     (beep)))
>>
>> (add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
>>
>> Is there a way that I can adapt my function above to stop it applying 
>> to the command buffer?
> 
> (when (and (not (eq major-mode 'shell-mode))
> 
>        (> (current-column) fill-column))

Great. That hits the nail on the head. Thanx.

Jesper - I do use auto-fill mode anyway! It is just too easy to type in 
a really long method call with no gaps and then find out at the end that 
I've gone over the fill-column but the auto-fill-mode does nothing to 
it, and even if it had done some wrapping, I would probably want to 
adjust it to make the code look prettier. If you follow me.


Adam

-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found] <mailman.3297.1068117967.21628.help-gnu-emacs@gnu.org>
  2003-11-06 15:41 ` line length control setting Jesper Harder
  2003-11-06 18:27 ` Kevin Rodgers
@ 2003-11-07 18:40 ` Gareth Rees
  2003-11-08 14:47   ` Adam Hardy
       [not found]   ` <mailman.46.1068306647.2005.help-gnu-emacs@gnu.org>
  2003-11-11 13:47 ` Oliver Scholz
  2003-12-07 15:29 ` Kai Grossjohann
  4 siblings, 2 replies; 23+ messages in thread
From: Gareth Rees @ 2003-11-07 18:40 UTC (permalink / raw)


Adam Hardy wrote:
> I am using a brute force method of stopping myself from writing long 
> lines of code, using this in my .emacs:

It's very drastic to do this using 'after-change-functions'; this stops
you from doing useful operations that temporarily create long lines that
you then propose to reformat (such as query-replace, delete-indentation,
or indent-region).

I suggest you use 'local-write-file-hooks' instead, perhaps using Line
Limit Mode, as described in this post to comp.emacs:
http://groups.google.com/groups?selm=uhfdaw35e.fsf%40pobox.com

-- 
Gareth Rees   http://www.garethrees.org/

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-07 18:40 ` Gareth Rees
@ 2003-11-08 14:47   ` Adam Hardy
       [not found]   ` <mailman.46.1068306647.2005.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-08 14:47 UTC (permalink / raw)


On 11/07/2003 07:40 PM Gareth Rees wrote:
> Adam Hardy wrote:
> 
>>I am using a brute force method of stopping myself from writing long 
>>lines of code, using this in my .emacs:
> 
> 
> It's very drastic to do this using 'after-change-functions'; this stops
> you from doing useful operations that temporarily create long lines that
> you then propose to reformat (such as query-replace, delete-indentation,
> or indent-region).
> 
> I suggest you use 'local-write-file-hooks' instead, perhaps using Line
> Limit Mode, as described in this post to comp.emacs:
> http://groups.google.com/groups?selm=uhfdaw35e.fsf%40pobox.com

 From what I can tell, it looks like it only alerts me to the over-long 
lines when I try to save - which would be too late for the way I work - 
or have I misunderstood it?


Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found]   ` <mailman.46.1068306647.2005.help-gnu-emacs@gnu.org>
@ 2003-11-10 18:39     ` Gareth Rees
  2003-11-11 11:10       ` Adam Hardy
  2003-11-11 11:20       ` Adam Hardy
  0 siblings, 2 replies; 23+ messages in thread
From: Gareth Rees @ 2003-11-10 18:39 UTC (permalink / raw)


Adam Hardy wrote:
> From what I can tell, it looks like it only alerts me to the over-long
> lines when I try to save - which would be too late for the way I work
> - or have I misunderstood it?

No, you're quite right.  But if you set your frame width appropriately,
then you can spot over-long lines immediately because they overflow the
right margin.  Line Limit mode then spots the lines you missed.  If it
isn't convenient to have the frame width similar to 'fill-column', then
you could try highlighting long lines, as described in
http://groups.google.com/groups?selm=vafr9cfozow.fsf%40lucy.cs.uni-dortmund.de

-- 
Gareth Rees

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-10 18:39     ` Gareth Rees
@ 2003-11-11 11:10       ` Adam Hardy
  2003-11-11 11:20       ` Adam Hardy
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-11 11:10 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 11/10/2003 07:39 PM Gareth Rees wrote:
> Adam Hardy wrote:
>>From what I can tell, it looks like it only alerts me to the over-long
>>lines when I try to save - which would be too late for the way I work
>>- or have I misunderstood it?
> 
> No, you're quite right.  But if you set your frame width appropriately,
> then you can spot over-long lines immediately because they overflow the
> right margin.  Line Limit mode then spots the lines you missed.  If it
> isn't convenient to have the frame width similar to 'fill-column', then
> you could try highlighting long lines, as described in
> http://groups.google.com/groups?selm=vafr9cfozow.fsf%40lucy.cs.uni-dortmund.de
> 

OK but it's a completely different paradigm. I have emacs maximized all 
the time but I could open it with a width of fill-column. I don't use 
the space on the right after the fill-column, but then I probably 
wouldn't know what to do with it :)

maybe it would be just as good to have a column display in the status 
bar just above the mini-buffer. How could I do that?

Or even better I remember when I used to use superedit or something 
similar, it drew a faint right margin on the page.


Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-10 18:39     ` Gareth Rees
  2003-11-11 11:10       ` Adam Hardy
@ 2003-11-11 11:20       ` Adam Hardy
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-11 11:20 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 11/06/2003 07:27 PM Kevin Rodgers wrote:
>>(defun my-dont-insert-after-fill-column (&rest x)
>>  (when (> (current-column)
>>            fill-column)
>>    (delete-char -1)
>>    (beep)))
>>(add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
>> 
>> But I discovered this is also acting on the command buffer, so I
>> cannot add more than my fill column when doing simple file copies or
>> renames or text search & replaces.
>> 
>> Is there a way that I can adapt my function above to stop it applying
>> to the command buffer?
> 
> (when (and (not (eq major-mode 'shell-mode))
>       (> (current-column) fill-column)) 
 >   ...)

emacs is applying the beeping and dels still in the mini-buffer when I 
issue dired commands on a dired listing, like copy or rename.

Obviously (eq major-mode 'shell-mode) does not cover dired? Is there a 
special mode in the mini-buffer window I can use to switch?


Thanks
Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found] <mailman.3297.1068117967.21628.help-gnu-emacs@gnu.org>
                   ` (2 preceding siblings ...)
  2003-11-07 18:40 ` Gareth Rees
@ 2003-11-11 13:47 ` Oliver Scholz
  2003-11-13  9:49   ` Adam Hardy
       [not found]   ` <mailman.28.1068720748.399.help-gnu-emacs@gnu.org>
  2003-12-07 15:29 ` Kai Grossjohann
  4 siblings, 2 replies; 23+ messages in thread
From: Oliver Scholz @ 2003-11-11 13:47 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> Hi All,
> I am using a brute force method of stopping myself from writing long
> lines of code, using this in my .emacs:
>
> (defun my-dont-insert-after-fill-column (&rest x)
>    (when (> (current-column)
>             fill-column)
>      (delete-char -1)
>      (beep)))
>
> (add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
>
> But I discovered this is also acting on the command buffer, so I
> cannot add more than my fill column when doing simple file copies or
> renames or text search & replaces.

Well, you could just check whether the current buffer is the
minibuffer:

(when (and (not (minibufferp))
	   (> (current-column)
	      fill-column))
  ...)
      
However, for my taste this is a little bit too obnoxious, too.  I'd
rather prefer some strong visual indication, like turning all lines
longer than 70 chars into a bright red:

(defface ah-overlong-lines
  '((t
     (:background "red")))
  "Face used to display overlong lines")

(defconst ah-overlong-lines-keywords
  '(("^.\\{70,500\\}$" 0 'ah-overlong-lines prepend)))

(font-lock-add-keywords nil ah-overlong-lines-keywords)


I seem to recall that there is some package that does something with
colour. I think with the colour of the cursor.  But I don't remember
its name.

Or simply turn auto-fill-mode on.  This does also some sort of the
right thing for programming modes (although it is not quite as smart
as I wish it would be).

    Oliver
-- 
21 Brumaire an 212 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-11 13:47 ` Oliver Scholz
@ 2003-11-13  9:49   ` Adam Hardy
       [not found]   ` <mailman.28.1068720748.399.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-13  9:49 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 11/11/2003 02:47 PM Oliver Scholz wrote:
> Adam Hardy <emacs@cyberspaceroad.com> writes:
>>I am using a brute force method of stopping myself from writing long
>>lines of code, using this in my .emacs:
>>
>>(defun my-dont-insert-after-fill-column (&rest x)
>>   (when (> (current-column)
>>            fill-column)
>>     (delete-char -1)
>>     (beep)))
>>
>>(add-hook 'after-change-functions 'my-dont-insert-after-fill-column)
>>
>>But I discovered this is also acting on the command buffer, so I
>>cannot add more than my fill column when doing simple file copies or
>>renames or text search & replaces.
> 
> 
> Well, you could just check whether the current buffer is the
> minibuffer:
> 
> (when (and (not (minibufferp))
> 	   (> (current-column)
> 	      fill-column))
>   ...)
>       
Hi Oliver,
emacs is choking on (minibufferp) - says it's a null-function. I presume 
it's saying it doesn't exist? I can't find any mention of it in the help.

Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found]   ` <mailman.28.1068720748.399.help-gnu-emacs@gnu.org>
@ 2003-11-13 12:02     ` Oliver Scholz
  2003-11-13 17:01       ` Kevin Rodgers
  0 siblings, 1 reply; 23+ messages in thread
From: Oliver Scholz @ 2003-11-13 12:02 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

[...]
> emacs is choking on (minibufferp) - says it's a null-function. I
> presume it's saying it doesn't exist? I can't find any mention of it
> in the help.

[...]
> GNU Emacs 21.3.1 on Linux 2.4.20 RH9
[...]

It seems that this function is new in the CVS version of Emacs.  I
wasn't aware of that. Sorry.

    Oliver

PS: We prefer to see the operating system called "GNU/Linux".
-- 
23 Brumaire an 212 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-13 12:02     ` Oliver Scholz
@ 2003-11-13 17:01       ` Kevin Rodgers
  2003-11-17 13:08         ` Adam Hardy
       [not found]         ` <mailman.157.1069078348.399.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Kevin Rodgers @ 2003-11-13 17:01 UTC (permalink / raw)


Oliver Scholz wrote:

> Adam Hardy <emacs@cyberspaceroad.com> writes:
> 
> [...]
> 
>>emacs is choking on (minibufferp) - says it's a null-function. I
>>presume it's saying it doesn't exist? I can't find any mention of it
>>in the help.
>>
> 
> [...]
> 
>>GNU Emacs 21.3.1 on Linux 2.4.20 RH9
>>
> [...]
> 
> It seems that this function is new in the CVS version of Emacs.  I
> wasn't aware of that. Sorry.

Can you emulate it like this?


(window-minibuffer-p (selected-window))

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-11-13 17:01       ` Kevin Rodgers
@ 2003-11-17 13:08         ` Adam Hardy
       [not found]         ` <mailman.157.1069078348.399.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-11-17 13:08 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 11/13/2003 06:01 PM Kevin Rodgers wrote:
> Oliver Scholz wrote:
>> Adam Hardy <emacs@cyberspaceroad.com> writes:
>>>> But I discovered this is also acting on the command buffer, so
>>>>  I cannot add more than my fill column when doing simple file 
>>>> copies or renames or text search & replaces.
> 
>>> Well, you could just check whether the current buffer is the 
>>> minibuffer:
> 
>>>> (when (and (not (minibufferp)) (> (current-column)
>>>> fill-column)) ...)
> 
>>> emacs is choking on (minibufferp) - says it's a null-function. I 
>>> presume it's saying it doesn't exist? I can't find any mention of
>>> it in the help.
>> 
>> It seems that this function is new in the CVS version of Emacs.  I 
>> wasn't aware of that. Sorry.
> 
> Can you emulate it like this?
> (window-minibuffer-p (selected-window))

Yes, works beautifully .

Thanks
Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 RH9

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found]         ` <mailman.157.1069078348.399.help-gnu-emacs@gnu.org>
@ 2003-11-17 14:56           ` Phillip Lord
  0 siblings, 0 replies; 23+ messages in thread
From: Phillip Lord @ 2003-11-17 14:56 UTC (permalink / raw)





I realise that this comes a little late in the thread. You could try
my wonderfully cheesy package "wide-column.el", which calls a function
based on the current line width. 

The default behaviour is to change cursor colour. You could make the
screen flash alternatively backward and forward, print "Press return
you maniac" in the minibuffer, or other warnings if you chose. 

But I like cursor colour. 

http://www.russet.org.uk/download/emacs/wide-column.el


Cheers

Phil

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found] <mailman.3297.1068117967.21628.help-gnu-emacs@gnu.org>
                   ` (3 preceding siblings ...)
  2003-11-11 13:47 ` Oliver Scholz
@ 2003-12-07 15:29 ` Kai Grossjohann
  2003-12-08  9:55   ` Adam Hardy
       [not found]   ` <mailman.1329.1070881092.399.help-gnu-emacs@gnu.org>
  4 siblings, 2 replies; 23+ messages in thread
From: Kai Grossjohann @ 2003-12-07 15:29 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> I am using a brute force method of stopping myself from writing long
> lines of code, using this in my .emacs:

Phillip already suggested wide-column.el.  There is also vvb.el or
similar which will draw a vertical line.  That's less brute force and
more a nice hint, but why not be polite to yourself?

Kai

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-12-07 15:29 ` Kai Grossjohann
@ 2003-12-08  9:55   ` Adam Hardy
       [not found]   ` <mailman.1329.1070881092.399.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-12-08  9:55 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 12/07/2003 04:29 PM Kai Grossjohann wrote:
> Adam Hardy <emacs@cyberspaceroad.com> writes:
>>I am using a brute force method of stopping myself from writing long
>>lines of code, using this in my .emacs:
> 
> Phillip already suggested wide-column.el.  There is also vvb.el or
> similar which will draw a vertical line.  That's less brute force and
> more a nice hint, but why not be polite to yourself?

vvb.el? I tried googling with "vvb.el emacs" and the only link that came 
up was your post above. A search on "emacs draw vertical line" only 
produced links to what appears to be a graph package.

Would this really just put in a vertical line at line-length and allow 
me to type text past it? If so, it sounds ideal. Is it really vvb.el? If 
so do you have a link to it somewhere?

Thanks
Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found]   ` <mailman.1329.1070881092.399.help-gnu-emacs@gnu.org>
@ 2003-12-08 18:14     ` Johan Bockgård
  2003-12-10 12:47       ` Adam Hardy
                         ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Johan Bockgård @ 2003-12-08 18:14 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> Would this really just put in a vertical line at line-length and allow
> me to type text past it? If so, it sounds ideal. Is it really vvb.el?
> If so do you have a link to it somewhere?

Yes. It's `vvb-mode'. The Emacs Lisp List has it (look for
vvb-mode2.el (ported from XEmacs)).

http://www.anc.ed.ac.uk/~stephen/emacs/ell.html

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-12-08 18:14     ` Johan Bockgård
@ 2003-12-10 12:47       ` Adam Hardy
  2003-12-12 11:37       ` Adam Hardy
       [not found]       ` <mailman.1629.1071232851.399.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-12-10 12:47 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 12/08/2003 07:14 PM Johan Bockgård wrote:
> Adam Hardy <emacs@cyberspaceroad.com> writes:
>>Would this really just put in a vertical line at line-length and allow
>>me to type text past it? If so, it sounds ideal. Is it really vvb.el?
>>If so do you have a link to it somewhere?
> 
> Yes. It's `vvb-mode'. The Emacs Lisp List has it (look for
> vvb-mode2.el (ported from XEmacs)).
> 
> http://www.anc.ed.ac.uk/~stephen/emacs/ell.html

That is fabulous. Thanks alot.

Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-12-08 18:14     ` Johan Bockgård
  2003-12-10 12:47       ` Adam Hardy
@ 2003-12-12 11:37       ` Adam Hardy
       [not found]       ` <mailman.1629.1071232851.399.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-12-12 11:37 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 12/08/2003 07:14 PM Johan Bockgård wrote:
> Adam Hardy <emacs@cyberspaceroad.com> writes:
  >>Would this really just put in a vertical line at line-length and allow
>>me to type text past it? If so, it sounds ideal. Is it really vvb.el?
>>If so do you have a link to it somewhere?
> 
> Yes. It's `vvb-mode'. The Emacs Lisp List has it (look for
> vvb-mode2.el (ported from XEmacs)).
> 
> http://www.anc.ed.ac.uk/~stephen/emacs/ell.html

I successfully set up vvb-mode to load through my .emacs for all modes, 
but I find it is totally unnecessary in some modes, like dired for 
instance.

I regularly need it in java-mode, html-helper-mode, css-mode, 
javascript-generic-mode etc.

I've been looking at the docs and examples and I can't figure out how I 
can set vvb-mode minor mode only for those modes I want it in. This is 
what I've currently got:

; put a vertical line in at the fill-column
(require 'vvb-mode)
(setq-default vvb-column fill-column
               vvb-sticky-p nil
               vvb-permanent-p t)
(setq-default vvb-right-on-eol-p t)
(setq-default vvb-mode 1)

How can I load it only for those modes I need it with?

Thanks in advance,
Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found]       ` <mailman.1629.1071232851.399.help-gnu-emacs@gnu.org>
@ 2003-12-12 18:58         ` Johan Bockgård
  2003-12-13 11:06           ` Adam Hardy
       [not found]           ` <mailman.15.1071317460.868.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Johan Bockgård @ 2003-12-12 18:58 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> ; put a vertical line in at the fill-column
> (require 'vvb-mode)
> (setq-default vvb-column fill-column
>                vvb-sticky-p nil
>                vvb-permanent-p t)
> (setq-default vvb-right-on-eol-p t)
> (setq-default vvb-mode 1)

The last line is the problem. Delete it.

> How can I load it only for those modes I need it with?

Turn on vvb-mode in the mode's hook.

(defun turn-on-vvb-mode ()
  "Unconditionally turn on Visible Vertical Bar mode."
  (vvb-mode 1))

(add-hook 'java-mode-hook 'turn-on-vvb-mode)

etc.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
  2003-12-12 18:58         ` Johan Bockgård
@ 2003-12-13 11:06           ` Adam Hardy
       [not found]           ` <mailman.15.1071317460.868.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Adam Hardy @ 2003-12-13 11:06 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 12/12/2003 07:58 PM Johan Bockgård wrote:
>>How can I load it only for those modes I need it with?
> 
> Turn on vvb-mode in the mode's hook.
> 
> (defun turn-on-vvb-mode ()
>   "Unconditionally turn on Visible Vertical Bar mode."
>   (vvb-mode 1))
> 
> (add-hook 'java-mode-hook 'turn-on-vvb-mode)

Hi again,
I got it working for most modes I need, but I tried setting it for 
emacs-lisp-mode:

(add-hook 'emacs-lisp-mode 'turn-on-vvb-mode)

and it doesn't turn on automatically when I open a lisp file, even 
though emacs automatically chooses Emacs-Lisp.

Strangely, if I do 'M-x emacs-lisp-mode', then it does work. Is there 
something special about emacs-lisp-mode?

Adam
-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: line length control setting
       [not found]           ` <mailman.15.1071317460.868.help-gnu-emacs@gnu.org>
@ 2003-12-13 18:13             ` Johan Bockgård
  0 siblings, 0 replies; 23+ messages in thread
From: Johan Bockgård @ 2003-12-13 18:13 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> I got it working for most modes I need, but I tried setting it for
> emacs-lisp-mode:
>
> (add-hook 'emacs-lisp-mode 'turn-on-vvb-mode)

> and it doesn't turn on automatically when I open a lisp file

Sure, you're missing a "-hook".

PS. You don't need to send me copies by mail.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2003-12-13 18:13 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3297.1068117967.21628.help-gnu-emacs@gnu.org>
2003-11-06 15:41 ` line length control setting Jesper Harder
2003-11-06 18:27 ` Kevin Rodgers
2003-11-07 13:57   ` Adam Hardy
2003-11-07 18:40 ` Gareth Rees
2003-11-08 14:47   ` Adam Hardy
     [not found]   ` <mailman.46.1068306647.2005.help-gnu-emacs@gnu.org>
2003-11-10 18:39     ` Gareth Rees
2003-11-11 11:10       ` Adam Hardy
2003-11-11 11:20       ` Adam Hardy
2003-11-11 13:47 ` Oliver Scholz
2003-11-13  9:49   ` Adam Hardy
     [not found]   ` <mailman.28.1068720748.399.help-gnu-emacs@gnu.org>
2003-11-13 12:02     ` Oliver Scholz
2003-11-13 17:01       ` Kevin Rodgers
2003-11-17 13:08         ` Adam Hardy
     [not found]         ` <mailman.157.1069078348.399.help-gnu-emacs@gnu.org>
2003-11-17 14:56           ` Phillip Lord
2003-12-07 15:29 ` Kai Grossjohann
2003-12-08  9:55   ` Adam Hardy
     [not found]   ` <mailman.1329.1070881092.399.help-gnu-emacs@gnu.org>
2003-12-08 18:14     ` Johan Bockgård
2003-12-10 12:47       ` Adam Hardy
2003-12-12 11:37       ` Adam Hardy
     [not found]       ` <mailman.1629.1071232851.399.help-gnu-emacs@gnu.org>
2003-12-12 18:58         ` Johan Bockgård
2003-12-13 11:06           ` Adam Hardy
     [not found]           ` <mailman.15.1071317460.868.help-gnu-emacs@gnu.org>
2003-12-13 18:13             ` Johan Bockgård
2003-11-06 11:24 Adam Hardy

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.