help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to apply a minor mode to all buffers


From: James Aguilar
Subject: Re: How to apply a minor mode to all buffers
Date: Thu, 18 Jan 2007 14:33:14 -0800

On 1/18/07, Drew Adams <drew.adams@oracle.com> wrote:
Library `column-marker.el' provides commands that create column markers in
the current buffer. AFAIK, no automatic way is provided to get the same
effect in all buffers. However, you can always use a column-marker command
in a mode hook, so that each buffer of that mode calls the command to create
the same column marker.

So there is no simple way to just make it apply to all buffers?  There's no "all-modes-hook" or anything like that?  This is so frustrating.  Someone must have needed this functionality before I did.

Can I make edits to the mode to make it global?  I'm thinking about margin.el, which uses the command margin-mode.  Here's the code in question:

;;;###autoload
(define-minor-mode margin-mode
  "Minor mode that displays a margin"
  nil " | " nil ;;Does the first nil here determine whether the mode is on or off by default?
  (if margin-mode
      (progn
        (margin-overlay-on)
        (jit-lock-register 'margin-change)
        (setq margin-mode t))
    ;; else
    (progn
      (margin-overlay-off)
      (jit-lock-unregister 'margin-change)
      (setq margin-mode nil))))

I thought that I might be able to change that to make it global somehow.  In another section of code somewhere else, I saw :global t at the beginning of the define-minor-mode function.  However, it didn't work properly.  Are there other things I need to do?  Would setting the first nil to t do the trick?

Yours,
James Aguilar
--
[?] James Aguilar
[@] 333 Rengstorff Ave #23, Mountain View, CA, 94043
[#] 314 494 0450
[!] Lately things just dont seem the same
reply via email to

[Prev in Thread] Current Thread [Next in Thread]