all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <jet@gyve.org>
Cc: emacs-devel@gnu.org
Subject: Re: Bug solved
Date: Thu, 30 Nov 2006 20:47:52 +0900 (JST)	[thread overview]
Message-ID: <20061130.204752.146241318.jet@gyve.org> (raw)
In-Reply-To: <3586896.1164809578196.JavaMail.www@wwinf4201>

> 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:anonymous@cvs.gnu.org:/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 ()

  parent reply	other threads:[~2006-11-30 11:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29 14:12 Bug solved A Soare
2006-11-29 18:46 ` Masatake YAMATO
2006-11-30 11:47 ` Masatake YAMATO [this message]
2006-11-30 13:33   ` Kim F. Storm
2006-11-30 16:12     ` Masatake YAMATO
  -- strict thread matches above, loose matches on Subject: below --
2006-12-01 14:51 A Soare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061130.204752.146241318.jet@gyve.org \
    --to=jet@gyve.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.