all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: A Soare <alinsoar@voila.fr>
Subject: Bug solved
Date: Wed, 29 Nov 2006 15:12:58 +0100 (CET)	[thread overview]
Message-ID: <3586896.1164809578196.JavaMail.www@wwinf4201> (raw)

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

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.

Best regards,

Alin Soare

[-- Attachment #2: diff-bug-hex-hl-line-emacs --]
[-- Type: application/octet-stream, Size: 1605 bytes --]

Index: emacs/lisp/hexl.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/hexl.el,v
retrieving revision 1.107
diff -c -r1.107 hexl.el
*** emacs/lisp/hexl.el	23 Nov 2006 18:34:44 -0000	1.107
--- emacs/lisp/hexl.el	29 Nov 2006 13:24:28 -0000
***************
*** 104,109 ****
--- 104,111 ----
  (defvar ruler-mode-ruler-function)
  (defvar hl-line-mode)
  
+ (defvar hexl-mode-old-hl-line-range-function)
+ (defvar hexl-mode-old-hl-line-face)
  (defvar hexl-mode-old-hl-line-mode)
  (defvar hexl-mode-old-local-map)
  (defvar hexl-mode-old-mode-name)
***************
*** 259,264 ****
--- 261,271 ----
      (setq hexl-mode-old-hl-line-mode
  	  (and (boundp 'hl-line-mode) hl-line-mode))
  
+     (set (make-local-variable 'hexl-mode-old-hl-line-range-function)
+          hl-line-range-function)
+     (set (make-local-variable 'hexl-mode-old-hl-line-face)
+          hl-line-face)
+ 
      (make-local-variable 'hexl-mode-old-syntax-table)
      (setq hexl-mode-old-syntax-table (syntax-table))
      (set-syntax-table (standard-syntax-table))
***************
*** 388,393 ****
--- 395,404 ----
        (ruler-mode 0))
    (if (and (boundp 'hl-line-mode) hl-line-mode (not hexl-mode-old-hl-line-mode))
        (hl-line-mode 0))
+ 
+   (set 'hl-line-range-function hexl-mode-old-hl-line-range-function)
+   (set '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)

[-- Attachment #3: commentary-bug-hex-hl-line-emacs --]
[-- Type: application/octet-stream, Size: 970 bytes --]

The hook function from the hexl-mode changed the value of the
hl-line-range-function variable, by assingning it the symbol
'hexl-highlight-line-range, called from hl-line.el:

(defun hl-line-move (overlay) ()
  "Move the Hl-Line overlay.
If `hl-line-range-function' is non-nil, move the OVERLAY to the position
where the function returns.  If `hl-line-range-function' is nil, fill
the line including the point by OVERLAY."
...
	(setq tmp (funcall hl-line-range-function)
...)

Before exit from the hexl-modecalling (hexl-mode-exit), the
old value of the hl-line-range-function was not restored.

That is what I did: to restore its value.

I declared a buffer-local variable in (hexl-mode) which keeps the old
value of hl-line-range-function, and in hexl-mode-exit I restored its
initial value.

Another solution would have been that (hexlify-buffer) put its
output into another buffer (without killing initial buffer). But for
this sol. there are lots of changes to do.

[-- Attachment #4: Changelog.alin-soare --]
[-- Type: application/octet-stream, Size: 263 bytes --]

2006-11-29  Alin C. Soare  <alinsoar@voila.fr>

	* lisp/hexl.el (hexl-mode-old-hl-line-range-function): New variable
	(hexl-mode-old-hl-line-face): New variable
	(hexl-mode, hexl-mode-exit): Fix the highlighting of the current
	line when exit from the hexl-mode.

[-- Attachment #5: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

             reply	other threads:[~2006-11-29 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29 14:12 A Soare [this message]
2006-11-29 18:46 ` Bug solved Masatake YAMATO
2006-11-30 11:47 ` Masatake YAMATO
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=3586896.1164809578196.JavaMail.www@wwinf4201 \
    --to=alinsoar@voila.fr \
    /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.