emacs-devel
[Top][All Lists]
Advanced

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

Re: Bug solved


From: Masatake YAMATO
Subject: Re: Bug solved
Date: Thu, 30 Nov 2006 20:47:52 +0900 (JST)

> BUG:
> 
> > 1) open an arbitrary file
> >    C-x C-f /root/.emacs for example
> > 2) suppose highlight current line minor mode is on. Sinon:
> >    (global-hl-line-mode 1)
> > 3) (hexl-mode)
> > 4) (hexl-mode-exit)
> >
> > BUG: (hexl-mode-exit) forgot to change again the highlight, and we see the 
> > normal text with the highl. from hex mode.
> >
> > version: GNU Emacs 22.0.91.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll 
> > bars) of 2006-11-24 on alin.ro
> > system: FC6: Linux alin.ro 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 
> > 2006 i686 athlon i386 GNU/Linux
> > 
> 
> I attached here
> - the output from cvs -d:pserver:address@hidden:/sources/emacs diff -c 
> emacs/lisp/hexl.el
> - a lisp/changelog entry
> - a little text file with comments
> 
> Please inform me if you accepted the solution.

Thank you for reporting bug and fixing it.
I reviewed your patch and modified it.
Generally your patch is good. However, the case that hl-line-range-function 
and/or
hl-line-face is/are not bound to value(s) is not handled.
So I modified your patch to handle the case.
I also did the same on ruler related code.
Could you test my patch?

I think it is almost ready to install the patch to the cvs repository.
However, I think about copyrigh assignment.
Other developers, sign for copyrigh assignment from Alin Soare is needed
in this case? Without white lines, Alin's original patch contains 6 lines.

Masatake YAMATO

Index: hexl.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/hexl.el,v
retrieving revision 1.107
diff -u -r1.107 hexl.el
--- hexl.el     23 Nov 2006 18:34:44 -0000      1.107
+++ hexl.el     30 Nov 2006 11:34:14 -0000
@@ -100,15 +100,22 @@
 
 (defvar hexl-mode-map nil)
 
+;; Variable declarations for suppressing warnings from the byte-compiler.
 (defvar ruler-mode)
 (defvar ruler-mode-ruler-function)
 (defvar hl-line-mode)
+(defvar hl-line-range-function)
+(defvar hl-line-face)
 
+;; Variables where the original values are stored to.
 (defvar hexl-mode-old-hl-line-mode)
+(defvar hexl-mode-old-hl-line-range-function)
+(defvar hexl-mode-old-hl-line-face)
 (defvar hexl-mode-old-local-map)
 (defvar hexl-mode-old-mode-name)
 (defvar hexl-mode-old-major-mode)
 (defvar hexl-mode-old-ruler-mode)
+(defvar hexl-mode-old-ruler-function)
 (defvar hexl-mode-old-isearch-search-fun-function)
 (defvar hexl-mode-old-require-final-newline)
 (defvar hexl-mode-old-syntax-table)
@@ -386,8 +393,16 @@
 
   (if (and (boundp 'ruler-mode) ruler-mode (not hexl-mode-old-ruler-mode))
       (ruler-mode 0))
+  (when (boundp 'hexl-mode-old-ruler-function)
+    (setq ruler-mode-ruler-function hexl-mode-old-ruler-function))
+
   (if (and (boundp 'hl-line-mode) hl-line-mode (not 
hexl-mode-old-hl-line-mode))
       (hl-line-mode 0))
+  (when (boundp 'hexl-mode-old-hl-line-range-function)
+    (setq hl-line-range-function hexl-mode-old-hl-line-range-function))
+  (when (boundp hexl-mode-old-hl-line-face)
+    (setq hl-line-face hexl-mode-old-hl-line-face))
+ 
   (setq require-final-newline hexl-mode-old-require-final-newline)
   (setq mode-name hexl-mode-old-mode-name)
   (setq isearch-search-fun-function hexl-mode-old-isearch-search-fun-function)
@@ -929,19 +944,26 @@
 (defun hexl-activate-ruler ()
   "Activate `ruler-mode'."
   (require 'ruler-mode)
+  (unless (boundp 'hexl-mode-old-ruler-function)
+    (set (make-local-variable 'hexl-mode-old-ruler-function)
+        ruler-mode-ruler-function))
   (set (make-local-variable 'ruler-mode-ruler-function)
        'hexl-mode-ruler)
   (ruler-mode 1))
 
 (defun hexl-follow-line ()
   "Activate `hl-line-mode'."
-  (require 'frame)
   (require 'hl-line)
-  (with-no-warnings
-    (set (make-local-variable 'hl-line-range-function)
-        'hexl-highlight-line-range)
-    (set (make-local-variable 'hl-line-face)
-        'highlight))
+  (unless (boundp 'hexl-mode-old-hl-line-range-function)
+    (set (make-local-variable 'hexl-mode-old-hl-line-range-function)
+        hl-line-range-function))
+  (unless (boundp 'hexl-mode-old-hl-line-face)
+    (set (make-local-variable 'hexl-mode-old-hl-line-face)
+        hl-line-face))
+  (set (make-local-variable 'hl-line-range-function)
+       'hexl-highlight-line-range)
+  (set (make-local-variable 'hl-line-face)
+       'highlight)
   (hl-line-mode 1))
 
 (defun hexl-highlight-line-range ()




reply via email to

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