all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 23.0.50; hexl-mode and auto-revert-mode incompatibilities
@ 2008-01-21  1:58 Simias
  2008-01-21 13:38 ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Simias @ 2008-01-21  1:58 UTC (permalink / raw)
  To: emacs-pretest-bug

  If I open a file in emacs, enable both hexl-mode and
auto-revert-mode in its buffer and then modify the content of the file
externally, the buffer gets refreshed but its content seems... rather
littered. C-l doesn't fix it.

  I have similar problems with "auto-revert-tail-mode", but not when I
revert the buffer "manually" with M-x revert-buffer.

  It seems that when the buffer gets refreshed, it behaves as if
hexl-mode was not here (for instance with auto-revert-tail-mode, it
just appends the text, without printing the hex values) but I'm not
sure about what's going on here.

  To sum up, here's how to reproduce the bug:
    - open emacs
    - open a file
    - enable both hexl-mode and auto-revert-mode
    - modify the file externally (echo blah >> /the/file should suffice)
    - ????????
    - profit!!


In GNU Emacs 23.0.50.2 (i386-unknown-freebsd7.0, X toolkit)
 of 2008-01-21 on simias.hd.free.fr
Windowing system distributor `The X.Org Foundation', version 11.0.10400000
configured using `configure  '--prefix=/usr/local/' '--mandir=/usr/local/man' '--with-x-toolkit=lucid' '--without-toolkit-scroll-bars''

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  auto-revert-mode: t
  icomplete-mode: t
  iswitchb-mode: t
  show-paren-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Recent input:
e x <tab> m o C-h C-h SPC m o <tab> <return> M-x M-p 
M-p M-p M-p <return> <switch-frame> C-a C-a C-k C-k 
C-x C-s <switch-frame> C-x o o x C-_ C-x b RET C-x 
b e s h RET M-p <return> C-x o C-x o C-n C-p C-b C-b 
C-b C-b C-b C-b C-b C-a C-x C-x C-g C-f C-f C-b C-b 
C-b <switch-frame> M-x e m a c s SPC r e C-h C-h b 
u C-h C-h C-h C-h C-h C-h C-h C-h C-h C-h C-h b u g 
C-h C-h C-h e m a c s <tab> <tab> C-h C-h C-h C-h C-h 
C-h r e p <tab> o r <tab> b <tab> <return> a u t o 
- C-h C-g M-x M-p M-p C-g M-p C-_ M-x M-p M-p RET C-g 
C-g <switch-frame> C-x k RET M-x M-p M-p C-g C-x C-f 
/ / t m <return> c a C-h C-h t u C-h RET c a RET M-x 
h e x l SPC m o <tab> <return> C-x o C-x o M-p <return> 
<switch-frame> C-p C-p C-p C-p C-p C-p C-p C-p C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p C-p C-k C-k 
C-y C-y C-s C-g C-x C-s <switch-frame> M-p <return> 
<switch-frame> C-p C-k C-k C-x C-s <switch-frame> <switch-frame> 
C-c c <switch-frame> M-p <return> <switch-frame> <switch-frame> 
C-x o C-x o M-x a u t o SPC r e <tab> m o <tab> <return> 
C-x k RET C-x C-f M-p <tab> M-x h e x <tab> SPC m o 
<tab> <return> M-x a u t o SPC r e v <tab> m o <tab> 
<return> <switch-frame> C-p C-k C-k C-y C-y C-x C-s 
C-c c <switch-frame> C-x o C-x o M-p <return> <switch-frame> 
M-x M-p M-p M-p M-p M-p M-p <return>

Recent messages:
Wrote /home/simias/dev/cpp/jisho/trunk/src/DictCache.cc
(No files need saving)
History item: 128
Reverting buffer `cache'.
Auto-Revert mode enabled
Mark set [2 times]
Wrote /home/simias/dev/cpp/jisho/trunk/src/DictCache.cc
(No files need saving)
History item: 128
Reverting buffer `cache'.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 23.0.50; hexl-mode and auto-revert-mode incompatibilities
  2008-01-21  1:58 23.0.50; hexl-mode and auto-revert-mode incompatibilities Simias
@ 2008-01-21 13:38 ` martin rudalics
  2008-01-22  2:06   ` Simias
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2008-01-21 13:38 UTC (permalink / raw)
  To: Simias; +Cc: emacs-pretest-bug

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

 >   If I open a file in emacs, enable both hexl-mode and
 > auto-revert-mode in its buffer and then modify the content of the file
 > externally, the buffer gets refreshed but its content seems... rather
 > littered. C-l doesn't fix it.
 >
 >   I have similar problems with "auto-revert-tail-mode", but not when I
 > revert the buffer "manually" with M-x revert-buffer.
 >
 >   It seems that when the buffer gets refreshed, it behaves as if
 > hexl-mode was not here (for instance with auto-revert-tail-mode, it
 > just appends the text, without printing the hex values) but I'm not
 > sure about what's going on here.

It's because `auto-revert-mode' doesn't reset the major mode when
reverting the buffer and `hexl-mode' does nothing when the buffer is
already in `hexl-mode'.  Does the attached patch give good results?

[-- Attachment #2: hexl.patch --]
[-- Type: text/plain, Size: 1287 bytes --]

*** hexl.el.~1.115.~	Sat Oct 27 12:07:12 2007
--- hexl.el	Mon Jan 21 14:32:58 2008
***************
*** 136,141 ****
--- 136,143 ----
  
  (put 'hexl-mode 'mode-class 'special)
  
+ (defvar hexl-revert nil)
+ 
  ;;;###autoload
  (defun hexl-mode (&optional arg)
    "\\<hexl-mode-map>A mode for editing binary files in hex dump format.
***************
*** 211,217 ****
  
  \\[describe-bindings] for advanced commands."
    (interactive "p")
!   (unless (eq major-mode 'hexl-mode)
      (let ((modified (buffer-modified-p))
  	  (inhibit-read-only t)
  	  (original-point (- (point) (point-min))))
--- 213,219 ----
  
  \\[describe-bindings] for advanced commands."
    (interactive "p")
!   (unless (and (eq major-mode 'hexl-mode) (not hexl-revert))
      (let ((modified (buffer-modified-p))
  	  (inhibit-read-only t)
  	  (original-point (- (point) (point-min))))
***************
*** 322,328 ****
    (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t))
  
  (defun hexl-after-revert-hook ()
!   (hexl-mode))
  
  (defvar hexl-in-save-buffer nil)
  
--- 324,331 ----
    (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t))
  
  (defun hexl-after-revert-hook ()
!   (let ((hexl-revert t))
!     (hexl-mode)))
  
  (defvar hexl-in-save-buffer nil)
  

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 23.0.50; hexl-mode and auto-revert-mode incompatibilities
  2008-01-21 13:38 ` martin rudalics
@ 2008-01-22  2:06   ` Simias
  2008-01-22 13:50     ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Simias @ 2008-01-22  2:06 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

martin rudalics <rudalics@gmx.at> writes:

>>   If I open a file in emacs, enable both hexl-mode and
>> auto-revert-mode in its buffer and then modify the content of the file
>> externally, the buffer gets refreshed but its content seems... rather
>> littered. C-l doesn't fix it.
>>
>>   I have similar problems with "auto-revert-tail-mode", but not when I
>> revert the buffer "manually" with M-x revert-buffer.
>>
>>   It seems that when the buffer gets refreshed, it behaves as if
>> hexl-mode was not here (for instance with auto-revert-tail-mode, it
>> just appends the text, without printing the hex values) but I'm not
>> sure about what's going on here.
>
> It's because `auto-revert-mode' doesn't reset the major mode when
> reverting the buffer and `hexl-mode' does nothing when the buffer is
> already in `hexl-mode'.  Does the attached patch give good results?
> *** hexl.el.~1.115.~	Sat Oct 27 12:07:12 2007
> --- hexl.el	Mon Jan 21 14:32:58 2008
  [...]

  Thank you for investigating this.

  It does for auto-revert-mode (everything seems to work fine), however
with auto-revert-tail-mode it's even more broken. When I append to a
file externally and both auto-revert-tail-mode and hexl-mode are
activated, first emacs tells me:
"Converting to hexl format discards undo info; ok? (y or n)",
and when I answer "yes" the buffer fills with gibberish.
  
  Thanks again,
-- 
Simias

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 23.0.50; hexl-mode and auto-revert-mode incompatibilities
  2008-01-22  2:06   ` Simias
@ 2008-01-22 13:50     ` martin rudalics
  2008-01-25  8:55       ` Simias
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2008-01-22 13:50 UTC (permalink / raw)
  To: Simias; +Cc: emacs-pretest-bug

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

>   It does for auto-revert-mode (everything seems to work fine), however
> with auto-revert-tail-mode it's even more broken. When I append to a
> file externally and both auto-revert-tail-mode and hexl-mode are
> activated, first emacs tells me:
> "Converting to hexl format discards undo info; ok? (y or n)",
> and when I answer "yes" the buffer fills with gibberish.

Sorry, my attempt was too simplistic.  Please try again with the
attached patch.  I think something better is needed, but an
important first step would be to test whether revert-buffer works
correctly whenever the file changes.

[-- Attachment #2: hexl.patch --]
[-- Type: text/plain, Size: 3182 bytes --]

*** autorevert.el	Thu Jan 10 19:25:18 2008
--- autorevert.el	Tue Jan 22 14:24:16 2008
***************
*** 412,417 ****
--- 412,419 ----
         (not (memq major-mode
  		  global-auto-revert-ignore-modes)))))
  
+ (defvar auto-revert-tail-is-revert-buffer nil)
+ 
  (defun auto-revert-handler ()
    "Revert current buffer, if appropriate.
  This is an internal function used by Auto-Revert Mode."
***************
*** 448,454 ****
  		    (= (window-point window) (point-max))
  		    (push window eoblist)))
  	   'no-mini t))
! 	(if auto-revert-tail-mode
  	    (auto-revert-tail-handler size)
  	  ;; Bind buffer-read-only in case user has done C-x C-q,
  	  ;; so as not to forget that.  This gives undesirable results
--- 450,457 ----
  		    (= (window-point window) (point-max))
  		    (push window eoblist)))
  	   'no-mini t))
! 	(if (and auto-revert-tail-mode
! 		 (not auto-revert-tail-is-revert-buffer))
  	    (auto-revert-tail-handler size)
  	  ;; Bind buffer-read-only in case user has done C-x C-q,
  	  ;; so as not to forget that.  This gives undesirable results

*** hexl.el	Thu Jan 10 19:25:24 2008
--- hexl.el	Tue Jan 22 14:27:52 2008
***************
*** 136,141 ****
--- 136,144 ----
  
  (put 'hexl-mode 'mode-class 'special)
  
+ (defvar auto-revert-tail-is-revert-buffer)
+ (defvar hexl-revert nil)
+ 
  ;;;###autoload
  (defun hexl-mode (&optional arg)
    "\\<hexl-mode-map>A mode for editing binary files in hex dump format.
***************
*** 211,217 ****
  
  \\[describe-bindings] for advanced commands."
    (interactive "p")
!   (unless (eq major-mode 'hexl-mode)
      (let ((modified (buffer-modified-p))
  	  (inhibit-read-only t)
  	  (original-point (- (point) (point-min))))
--- 214,220 ----
  
  \\[describe-bindings] for advanced commands."
    (interactive "p")
!   (unless (and (eq major-mode 'hexl-mode) (not hexl-revert))
      (let ((modified (buffer-modified-p))
  	  (inhibit-read-only t)
  	  (original-point (- (point) (point-min))))
***************
*** 249,254 ****
--- 252,259 ----
      (setq hexl-mode-old-mode-name mode-name)
      (setq mode-name "Hexl")
  
+     (set (make-local-variable 'auto-revert-tail-is-revert-buffer) t)
+ 
      (set (make-local-variable 'hexl-mode-old-isearch-search-fun-function)
  	 isearch-search-fun-function)
      (set (make-local-variable 'isearch-search-fun-function)
***************
*** 322,328 ****
    (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t))
  
  (defun hexl-after-revert-hook ()
!   (hexl-mode))
  
  (defvar hexl-in-save-buffer nil)
  
--- 327,334 ----
    (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t))
  
  (defun hexl-after-revert-hook ()
!   (let ((hexl-revert t))
!     (hexl-mode)))
  
  (defvar hexl-in-save-buffer nil)
  
***************
*** 388,393 ****
--- 394,401 ----
  	  (or (bobp) (setq original-point (1+ original-point))))
  	(goto-char original-point)))
  
+   (setq auto-revert-tail-is-revert-buffer nil)
+ 
    (remove-hook 'before-revert-hook 'hexl-before-revert-hook t)
    (remove-hook 'after-revert-hook 'hexl-after-revert-hook t)
    (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t)


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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 23.0.50; hexl-mode and auto-revert-mode incompatibilities
  2008-01-22 13:50     ` martin rudalics
@ 2008-01-25  8:55       ` Simias
  2008-01-25  9:28         ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Simias @ 2008-01-25  8:55 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

martin rudalics <rudalics@gmx.at> writes:

>>   It does for auto-revert-mode (everything seems to work fine), however
>> with auto-revert-tail-mode it's even more broken. When I append to a
>> file externally and both auto-revert-tail-mode and hexl-mode are
>> activated, first emacs tells me:
>> "Converting to hexl format discards undo info; ok? (y or n)",
>> and when I answer "yes" the buffer fills with gibberish.
>
> Sorry, my attempt was too simplistic.  Please try again with the
> attached patch.  I think something better is needed, but an
> important first step would be to test whether revert-buffer works
> correctly whenever the file changes.

  Mmh, it behaves the same way as in the first patch for me, I hope I
haven't made a mistake. auto-revert-tail-mode still breaks.

-- 
Simias

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 23.0.50; hexl-mode and auto-revert-mode incompatibilities
  2008-01-25  8:55       ` Simias
@ 2008-01-25  9:28         ` martin rudalics
  0 siblings, 0 replies; 6+ messages in thread
From: martin rudalics @ 2008-01-25  9:28 UTC (permalink / raw)
  To: Simias; +Cc: emacs-pretest-bug

 >   Mmh, it behaves the same way as in the first patch for me, I hope I
 > haven't made a mistake. auto-revert-tail-mode still breaks.

So even brute force won't help us here?  Could you, for testing
purposes, insert at the beginning of `auto-revert-tail-handler' a
message like:

(defun auto-revert-tail-handler (size)
   (message "%s" auto-revert-tail-is-revert-buffer) (ding)
   (let ((modified (buffer-modified-p))

evaluate that and tell me what gets printed for hexl-mode buffers?
Basically,

     (set (make-local-variable 'auto-revert-tail-is-revert-buffer) t)

in hexl-mode together with

	(if (and auto-revert-tail-mode
		 (not auto-revert-tail-is-revert-buffer))
	    (auto-revert-tail-handler size)

in `auto-revert-handler' should assure that `auto-revert-tail-handler'
is _never_ called for hexl-mode buffers.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-01-25  9:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21  1:58 23.0.50; hexl-mode and auto-revert-mode incompatibilities Simias
2008-01-21 13:38 ` martin rudalics
2008-01-22  2:06   ` Simias
2008-01-22 13:50     ` martin rudalics
2008-01-25  8:55       ` Simias
2008-01-25  9:28         ` martin rudalics

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.