emacs-pretest-bug
[Top][All Lists]
Advanced

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

hexlify-buffer warns "discards undo info; ok?" when no undo info is bein


From: Chris
Subject: hexlify-buffer warns "discards undo info; ok?" when no undo info is being kept
Date: Thu, 11 Jan 2007 13:59:45 +0100

buffer-undo-list is a variable defined in `src/buffer.c'.
If the value of the variable is t, undo information is not recorded.

hexlify-buffer does this:

  (and buffer-undo-list
       (or (y-or-n-p "Converting to hexl format discards undo info; ok? ")
           (error "Aborted")))

If undo is disabled in the buffer, buffer-undo-list is t, and
hexlify-buffer will about discarding unfo info that
doesn't exist and will then enable the storage of undo information.

The same goes for dehexlify-buffer.

Here's a patch which only discards undo information if undo isn't disabled:

------------------------------------------------------------------------
--- lisp/hexl.el        2006-12-01 00:30:52.000000000 +0100
+++ /tmp/hexl.el        2007-01-11 13:56:58.000000000 +0100
@@ -706,10 +706,11 @@
   "Convert a binary buffer to hexl format.
 This discards the buffer's undo information."
   (interactive)
-  (and buffer-undo-list
-       (or (y-or-n-p "Converting to hexl format discards undo info; ok? ")
-          (error "Aborted")))
-  (setq buffer-undo-list nil)
+  (unless (eq buffer-undo-list t)
+    (and buffer-undo-list
+        (or (y-or-n-p "Converting to hexl format discards undo info; ok? ")
+            (error "Aborted")))
+    (setq buffer-undo-list nil))
   ;; Don't decode text in the ASCII part of `hexl' program output.
   (let ((coding-system-for-read 'raw-text)
        (coding-system-for-write buffer-file-coding-system)
@@ -731,10 +732,11 @@
   "Convert a hexl format buffer to binary.
 This discards the buffer's undo information."
   (interactive)
-  (and buffer-undo-list
-       (or (y-or-n-p "Converting from hexl format discards undo info; ok? ")
-          (error "Aborted")))
-  (setq buffer-undo-list nil)
+  (unless (eq buffer-undo-list t)
+    (and buffer-undo-list
+        (or (y-or-n-p "Converting from hexl format discards undo info; ok? ")
+            (error "Aborted")))
+    (setq buffer-undo-list nil))
   (let ((coding-system-for-write 'raw-text)
        (coding-system-for-read buffer-file-coding-system)
        (buffer-undo-list t))
------------------------------------------------------------------------

In GNU Emacs 22.0.92.4 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-01-10 on trpaslik
X server distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-gtk' '--prefix' '/usr/local' '--with-xpm' 
'--with-jpeg' '--with-png' '--with-gif''




reply via email to

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