all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* visually mark off 80th column?
@ 2010-01-22  1:42 Brendan Miller
  2010-01-22  1:53 ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Brendan Miller @ 2010-01-22  1:42 UTC (permalink / raw)
  To: help-gnu-emacs

In my other editors I always turn on a little line that delimits the
80th column. How do I do this in emacs?

I'm on emacs 23, with gnome integration on ubuntu.




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

* RE: visually mark off 80th column?
  2010-01-22  1:42 visually mark off 80th column? Brendan Miller
@ 2010-01-22  1:53 ` Drew Adams
  2010-01-22 19:23   ` Brendan Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2010-01-22  1:53 UTC (permalink / raw)
  To: 'Brendan Miller', help-gnu-emacs

> In my other editors I always turn on a little line that delimits the
> 80th column. How do I do this in emacs?

http://www.emacswiki.org/emacs/FindLongLines#ShowLongLines





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

* Re: visually mark off 80th column?
  2010-01-22  1:53 ` Drew Adams
@ 2010-01-22 19:23   ` Brendan Miller
  2010-01-22 19:41     ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Brendan Miller @ 2010-01-22 19:23 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

I installed ColumnMarker from here:
http://www.emacswiki.org/emacs/ColumnMarker

into ~/emacs and then put this in my emacs file to always highlight
the 80th column:
(add-to-list 'load-path "~/emacs/")
(require 'column-marker)
(column-marker-1 80)

However this does nothing.

If I m-x column-marker-1 it simply highlights the current line...

anyone know what's going on? I almost never touch elisp.

Brendan

On Thu, Jan 21, 2010 at 5:53 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> In my other editors I always turn on a little line that delimits the
>> 80th column. How do I do this in emacs?
>
> http://www.emacswiki.org/emacs/FindLongLines#ShowLongLines
>
>




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

* RE: visually mark off 80th column?
  2010-01-22 19:23   ` Brendan Miller
@ 2010-01-22 19:41     ` Drew Adams
       [not found]       ` <ef38762f1001221333n4387d296hc417e9af57e5b938@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2010-01-22 19:41 UTC (permalink / raw)
  To: 'Brendan Miller'; +Cc: help-gnu-emacs

> On Thu, Jan 21, 2010 at 5:53 PM, Drew Adams wrote:
> >> In my other editors I always turn on a little line that 
> >> delimits the 80th column. How do I do this in emacs?
> >
> > http://www.emacswiki.org/emacs/FindLongLines#ShowLongLines
> 
> I installed ColumnMarker from here:
> http://www.emacswiki.org/emacs/ColumnMarker
> into ~/emacs and then put this in my emacs file to always highlight
> the 80th column:
>
> (add-to-list 'load-path "~/emacs/")
> (require 'column-marker)
> (column-marker-1 80)
> 
> However this does nothing.

Hm. Works for me.

Do you actually have lines longer than 80 chars? ;-)
If not, try using (column-marker 30) as a test.

What happens if you do this interactively (in a buffer with long lines)?

M-: (column-marker-1 80)

> If I m-x column-marker-1 it simply highlights the current line...

That's the expected behavior.

If it works for you interactively like that, there's no reason it shouldn't also
work for you in your .emacs.

If it really doesn't work, try (a) loading column-marker.el (not *.elc), then
(b) `M-x debug-on-entry column-marker-1', and step through the execution using
`d', to see what happens.


BTW, if you want the highlighting only for certain modes, then use the mode hook
functions to turn it on there:

(add-hook 'foo-mode-hook
          (lambda ()
            (interactive)
            (column-marker-1 80)))





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

* Fwd: visually mark off 80th column?
       [not found]       ` <ef38762f1001221333n4387d296hc417e9af57e5b938@mail.gmail.com>
@ 2010-01-22 21:33         ` Brendan Miller
  2010-01-22 22:28           ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Brendan Miller @ 2010-01-22 21:33 UTC (permalink / raw)
  To: help-gnu-emacs

Er, woops I forgot to cc the list.

---------- Forwarded message ----------
From: Brendan Miller <catphive@catphive.net>
Date: Fri, Jan 22, 2010 at 1:33 PM
Subject: Re: visually mark off 80th column?
To: Drew Adams <drew.adams@oracle.com>


M-: (column-marker-1 80)

*does* work, but for some reason just having:

(add-to-list 'load-path "~/emacs/")
(require 'column-marker)
(column-marker-1 80)

In my .emacs file does nothing! Very confusing. I'll post my whole
.emacs file at the end, just in case I'm doing something that
conflicts...

I also notice that when I type M-: (column-marker-1 80) it only
highlights the part of the column that have characters, which isn't
really what I want. Is there any way to make this highlight the whole
column?

This is my complete ~/.emacs file running on emacs 23:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(initial-buffer-choice nil)
 '(scroll-bar-mode (quote right)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(setq inhibit-splash-screen t)
(add-to-list 'load-path "~/emacs/")
(require 'column-marker)
(column-marker-1 80)

;; tabbar
(require 'tabbar)
(tabbar-mode)
(global-set-key [(s-right)] 'tabbar-forward)
(global-set-key [(s-left)] 'tabbar-backward)

;; try to get clipboard working
; stops selection with a mouse being immediately injected to the kill ring
(setq mouse-drag-copy-region nil)
; stops killing/yanking interacting with primary X11 selection
(setq x-select-enable-primary nil)
; makes killing/yanking interact with clipboard X11 selection
(setq x-select-enable-clipboard t)


;; supposedly this part may be stopped by a bug...
;  active region sets primary X11 selection
(setq select-active-regions t)
; make mouse middle-click only paste from primary X11 selection, not
clipboard and kill ring.
(global-set-key [mouse-2] 'mouse-yank-primary)

On Fri, Jan 22, 2010 at 11:41 AM, Drew Adams <drew.adams@oracle.com> wrote:
>> On Thu, Jan 21, 2010 at 5:53 PM, Drew Adams wrote:
>> >> In my other editors I always turn on a little line that
>> >> delimits the 80th column. How do I do this in emacs?
>> >
>> > http://www.emacswiki.org/emacs/FindLongLines#ShowLongLines
>>
>> I installed ColumnMarker from here:
>> http://www.emacswiki.org/emacs/ColumnMarker
>> into ~/emacs and then put this in my emacs file to always highlight
>> the 80th column:
>>
>> (add-to-list 'load-path "~/emacs/")
>> (require 'column-marker)
>> (column-marker-1 80)
>>
>> However this does nothing.
>
> Hm. Works for me.
>
> Do you actually have lines longer than 80 chars? ;-)
> If not, try using (column-marker 30) as a test.
>
> What happens if you do this interactively (in a buffer with long lines)?
>
> M-: (column-marker-1 80)
>
>> If I m-x column-marker-1 it simply highlights the current line...
>
> That's the expected behavior.
>
> If it works for you interactively like that, there's no reason it shouldn't also
> work for you in your .emacs.
>
> If it really doesn't work, try (a) loading column-marker.el (not *.elc), then
> (b) `M-x debug-on-entry column-marker-1', and step through the execution using
> `d', to see what happens.
>
>
> BTW, if you want the highlighting only for certain modes, then use the mode hook
> functions to turn it on there:
>
> (add-hook 'foo-mode-hook
>          (lambda ()
>            (interactive)
>            (column-marker-1 80)))
>
>




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

* RE: visually mark off 80th column?
  2010-01-22 21:33         ` Fwd: " Brendan Miller
@ 2010-01-22 22:28           ` Drew Adams
  2010-01-23  0:02             ` Brendan Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Drew Adams @ 2010-01-22 22:28 UTC (permalink / raw)
  To: 'Brendan Miller', help-gnu-emacs

> M-: (column-marker-1 80)
> *does* work, but for some reason just having:
> (add-to-list 'load-path "~/emacs/")
> (require 'column-marker)
> (column-marker-1 80)
>
> In my .emacs file does nothing! Very confusing. I'll post my whole
> .emacs file at the end, just in case I'm doing something that
> conflicts...

The reason is because `column-marker' is local to the current buffer. Doing what
you did sets it (only) for the buffer that is current during loading of your
.emacs.

Set it in a mode hook, as I suggested, to turn it on automatically for any
buffer of a particular mode. This is described in the file header.
 
> I also notice that when I type M-: (column-marker-1 80) it only
> highlights the part of the column that have characters, which isn't
> really what I want. Is there any way to make this highlight the whole
> column?

Not that I know of.

But you might be able to use `vline.el' (with `vline-style' = `compose') to do
what you want. You will need to create a command that pins the highlighting to a
particular column.





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

* Re: visually mark off 80th column?
  2010-01-22 22:28           ` Drew Adams
@ 2010-01-23  0:02             ` Brendan Miller
  2010-01-23  0:15               ` Drew Adams
  2010-01-23 15:31               ` Kevin Rodgers
  0 siblings, 2 replies; 11+ messages in thread
From: Brendan Miller @ 2010-01-23  0:02 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

vline would be ideal... but I don't see a way to pin highlighting to
the 80th column.

Based on this thread and some others I've come up with this using the
highlight-80+ package.

;; highlight all characters past 80
(require 'highlight-80+)
(dolist (hook '(emacs-lisp-mode-hook
                cperl-mode-hook
                shell-mode-hook
                text-mode-hook
                change-log-mode-hook
                makefile-mode-hook
                message-mode-hook
                texinfo-mode-hook
		c-mode-common-hook
		python-mode-hook))
  (add-hook hook
	    '(lambda () (highlight-80+-mode))))

One minor point, is I really want this to apply to *all* modes, not
just the ones I thought to list here. Is there any global mode hook
that applies to everything? The only files I would ever edit with
emacs would have the 80 line rule apply to them i.e. I don't do word
processing in emacs.

On Fri, Jan 22, 2010 at 2:28 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> M-: (column-marker-1 80)
>> *does* work, but for some reason just having:
>> (add-to-list 'load-path "~/emacs/")
>> (require 'column-marker)
>> (column-marker-1 80)
>>
>> In my .emacs file does nothing! Very confusing. I'll post my whole
>> .emacs file at the end, just in case I'm doing something that
>> conflicts...
>
> The reason is because `column-marker' is local to the current buffer. Doing what
> you did sets it (only) for the buffer that is current during loading of your
> .emacs.
>
> Set it in a mode hook, as I suggested, to turn it on automatically for any
> buffer of a particular mode. This is described in the file header.
>
>> I also notice that when I type M-: (column-marker-1 80) it only
>> highlights the part of the column that have characters, which isn't
>> really what I want. Is there any way to make this highlight the whole
>> column?
>
> Not that I know of.
>
> But you might be able to use `vline.el' (with `vline-style' = `compose') to do
> what you want. You will need to create a command that pins the highlighting to a
> particular column.
>
>




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

* RE: visually mark off 80th column?
  2010-01-23  0:02             ` Brendan Miller
@ 2010-01-23  0:15               ` Drew Adams
  2010-01-23 15:31               ` Kevin Rodgers
  1 sibling, 0 replies; 11+ messages in thread
From: Drew Adams @ 2010-01-23  0:15 UTC (permalink / raw)
  To: 'Brendan Miller'; +Cc: help-gnu-emacs

> vline would be ideal... but I don't see a way to pin highlighting to
> the 80th column.

You'd have to write a bit of Elisp code, no doubt. I don't have time to look
into it for you, but maybe someone else is interested.

> I've come up with this using the highlight-80+ package.
> (require 'highlight-80+)
> (dolist (hook '(emacs-lisp-mode-hook ... python-mode-hook))
>   (add-hook hook
> 	    '(lambda () (highlight-80+-mode))))

I'm not familiar with highlight-80+. But you can do the same thing with
column-number.

> I really want this to apply to *all* modes, not
> just the ones I thought to list here. Is there any global mode hook
> that applies to everything?

Dunno. It might depend on your Emacs version.
Perhaps someone else has a good answer. 
Maybe `after-change-major-mode-hook'.





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

* Re: visually mark off 80th column?
  2010-01-23  0:02             ` Brendan Miller
  2010-01-23  0:15               ` Drew Adams
@ 2010-01-23 15:31               ` Kevin Rodgers
  1 sibling, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2010-01-23 15:31 UTC (permalink / raw)
  To: help-gnu-emacs

Brendan Miller wrote:
> vline would be ideal... but I don't see a way to pin highlighting to
> the 80th column.
> 
> Based on this thread and some others I've come up with this using the
> highlight-80+ package.
> 
> ;; highlight all characters past 80
> (require 'highlight-80+)
> (dolist (hook '(emacs-lisp-mode-hook
>                 cperl-mode-hook
>                 shell-mode-hook
>                 text-mode-hook
>                 change-log-mode-hook
>                 makefile-mode-hook
>                 message-mode-hook
>                 texinfo-mode-hook
> 		c-mode-common-hook
> 		python-mode-hook))
>   (add-hook hook
> 	    '(lambda () (highlight-80+-mode))))
> 
> One minor point, is I really want this to apply to *all* modes, not
> just the ones I thought to list here. Is there any global mode hook
> that applies to everything? The only files I would ever edit with
> emacs would have the 80 line rule apply to them i.e. I don't do word
> processing in emacs.

Some minor modes can be turned on by setting the mode variable (whereas
some can only be turned on by calling the mode function).  So you could
try setting the highlight-80+ mode variable globally, with setq-default.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: visually mark off 80th column?
       [not found] <mailman.1914.1264124551.18930.help-gnu-emacs@gnu.org>
@ 2010-01-25 18:03 ` Stefan Monnier
  2010-01-25 21:03 ` Max Penet
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2010-01-25 18:03 UTC (permalink / raw)
  To: help-gnu-emacs

> In my other editors I always turn on a little line that delimits the
> 80th column. How do I do this in emacs?

While there are various Elisp packages that try to provide such
functionality, Emacs's core code doesn't really make it possible to do
that in a robust way, sadly (e.g. because it doesn't allow displaying
something where there isn't text, and because it doesn't make it
easy/possible to account for variable-sized chars).

What I use is much simpler: make your window 80-columns wide.
The main advantage is that you then don't waste screen real-estate
displaying the "extra columns" past the 80th which you shouldn't be
using any way ;-)


        Stefan


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

* Re: visually mark off 80th column?
       [not found] <mailman.1914.1264124551.18930.help-gnu-emacs@gnu.org>
  2010-01-25 18:03 ` Stefan Monnier
@ 2010-01-25 21:03 ` Max Penet
  1 sibling, 0 replies; 11+ messages in thread
From: Max Penet @ 2010-01-25 21:03 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 22, 2:42 am, Brendan Miller <catph...@catphive.net> wrote:
> In my other editors I always turn on a little line that delimits the
> 80th column. How do I do this in emacs?
>
> I'm on emacs 23, with gnome integration on ubuntu.

I am using whitespace-mode for this. I have tried other options such
as column-marker, but this seemed cleaner and has no external
dependencies (if you are on emacs 23)

Just add this to your .emacs:

(setq whitespace-style (quote (lines-tail))
      whitespace-line-column 80)
(global-whitespace-mode 1)

It highlights characters after the 80th column in a pink background/
white foreground by default and this will work for all your buffer as
global-whitespace-mode suggests.


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

end of thread, other threads:[~2010-01-25 21:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-22  1:42 visually mark off 80th column? Brendan Miller
2010-01-22  1:53 ` Drew Adams
2010-01-22 19:23   ` Brendan Miller
2010-01-22 19:41     ` Drew Adams
     [not found]       ` <ef38762f1001221333n4387d296hc417e9af57e5b938@mail.gmail.com>
2010-01-22 21:33         ` Fwd: " Brendan Miller
2010-01-22 22:28           ` Drew Adams
2010-01-23  0:02             ` Brendan Miller
2010-01-23  0:15               ` Drew Adams
2010-01-23 15:31               ` Kevin Rodgers
     [not found] <mailman.1914.1264124551.18930.help-gnu-emacs@gnu.org>
2010-01-25 18:03 ` Stefan Monnier
2010-01-25 21:03 ` Max Penet

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.