emacs-devel
[Top][All Lists]
Advanced

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

turn-on/off-*MODE* (was: Re: PATCH: num3-mode for highlighting groups of


From: chad
Subject: turn-on/off-*MODE* (was: Re: PATCH: num3-mode for highlighting groups of digits in long numbers)
Date: Wed, 26 Sep 2012 14:36:04 -0700

On 26 Sep 2012, at 13:01, Stefan Monnier <address@hidden> wrote:

> - Removed turn-on-num3-mode since (num3-mode) does the same anyway.
>  I do see that when num3-mode is already enabled (turn-on-num3-mode) did
>  nothing whereas (num3-mode) will call font-lock-fontify-buffer but if
>  that's a problem, we should fix num3-mode.


Is there a general guideline for when to add or not add these?  I               
                                                                                
                                                                              
find them generally useful for hooks I've been running with the                 
                                                                                
                                                                              
following small patch to hl-line.el for several months, following               
                                                                                
                                                                             
the pattern in autofill and flyspell.              

Thanks,
*Chad

*** 155,160 ****
--- 155,174 ----
      (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t)
      (remove-hook 'pre-command-hook #'hl-line-unhighlight t)))
  
+ 
+ ;;;###autoload
+ (defun turn-on-hl-line ()
+   "Unconditionally turn on highlight-line mode."
+   (hl-line-mode 1))
+ 
+ ;;;###autoload
+ (defun turn-off-hl-line ()
+   "Unconditionally turn off highlight-line mode."
+   (hl-line-mode -1))
+ 
+ (custom-add-option 'dired-mode-hook 'turn-on-hl-line)
+ 
+ 
  (defun hl-line-highlight ()
    "Activate the Hl-Line overlay on the current line."
    (if hl-line-mode    ; Might be changed outside the mode function.




reply via email to

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