all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Simias <simias.n@gmail.com>
Cc: emacs-pretest-bug@gnu.org
Subject: Re: 23.0.50; hexl-mode and auto-revert-mode incompatibilities
Date: Tue, 22 Jan 2008 14:50:31 +0100	[thread overview]
Message-ID: <4795F4A7.4070302@gmx.at> (raw)
In-Reply-To: <86wsq2txze.fsf@simias.hd.free.fr>

[-- 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

  reply	other threads:[~2008-01-22 13:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-01-25  8:55       ` Simias
2008-01-25  9:28         ` martin rudalics

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=4795F4A7.4070302@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=simias.n@gmail.com \
    /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.