]> code.delx.au - gnu-emacs/blobdiff - lisp/hexl.el
; Revert "Use eldoc-documentation-functions"
[gnu-emacs] / lisp / hexl.el
index 13181ff0e3cd757347a1ade1b892477c528f1274..5f099a5afd5e8a49d6727021f2e992c1aeb01888 100644 (file)
@@ -1,10 +1,10 @@
 ;;; hexl.el --- edit a file in a hex dump format using the hexl filter -*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1994, 1998, 2001-2013 Free Software Foundation,
+;; Copyright (C) 1989, 1994, 1998, 2001-2016 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Keith Gabryelski <ag@wheaties.ai.mit.edu>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: data
 
 ;; This file is part of GNU Emacs.
@@ -91,17 +91,17 @@ as that will override any bit grouping options set here."
 (defcustom hexl-mode-hook '(hexl-follow-line hexl-activate-ruler)
   "Normal hook run when entering Hexl mode."
   :type 'hook
-  :options '(hexl-follow-line hexl-activate-ruler turn-on-eldoc-mode)
+  :options '(hexl-follow-line hexl-activate-ruler eldoc-mode)
   :group 'hexl)
 
 (defface hexl-address-region
   '((t (:inherit header-line)))
-  "Face used in address area of hexl-mode buffer."
+  "Face used in address area of Hexl mode buffer."
   :group 'hexl)
 
 (defface hexl-ascii-region
   '((t (:inherit header-line)))
-  "Face used in ascii area of hexl-mode buffer."
+  "Face used in ASCII area of Hexl mode buffer."
   :group 'hexl)
 
 (defvar hexl-max-address 0
@@ -283,10 +283,10 @@ using the function `hexlify-buffer'.
 Each line in the buffer has an \"address\" (displayed in hexadecimal)
 representing the offset into the file that the characters on this line
 are at and 16 characters from the file (displayed as hexadecimal
-values grouped every `hexl-bits' bits) and as their ASCII values.
+values grouped every `hexl-bits' bits, and as their ASCII values).
 
 If any of the characters (displayed as ASCII characters) are
-unprintable (control or meta characters) they will be replaced as
+unprintable (control or meta characters) they will be replaced by
 periods.
 
 If `hexl-mode' is invoked with an argument the buffer is assumed to be
@@ -294,7 +294,7 @@ in hexl format.
 
 A sample format:
 
-  HEX ADDR: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f     ASCII-TEXT
+  HEX ADDR: 0011 2233 4455 6677 8899 aabb ccdd eeff     ASCII-TEXT
   --------  ---- ---- ---- ---- ---- ---- ---- ----  ----------------
   00000000: 5468 6973 2069 7320 6865 786c 2d6d 6f64  This is hexl-mod
   00000010: 652e 2020 4561 6368 206c 696e 6520 7265  e.  Each line re
@@ -310,9 +310,9 @@ A sample format:
   000000b0: 7461 626c 6520 6368 6172 6163 7465 7220  table character
   000000c0: 7265 6769 6f6e 2e0a                      region..
 
-Movement is as simple as movement in a normal Emacs text buffer.  Most
-cursor movement bindings are the same (ie. Use \\[hexl-backward-char], \\[hexl-forward-char], \\[hexl-next-line], and \\[hexl-previous-line]
-to move the cursor left, right, down, and up).
+Movement is as simple as movement in a normal Emacs text buffer.
+Most cursor movement bindings are the same: use \\[hexl-backward-char], \\[hexl-forward-char], \\[hexl-next-line], and \\[hexl-previous-line]
+to move the cursor left, right, down, and up.
 
 Advanced cursor movement commands (ala \\[hexl-beginning-of-line], \\[hexl-end-of-line], \\[hexl-beginning-of-buffer], and \\[hexl-end-of-buffer]) are
 also supported.
@@ -336,7 +336,7 @@ into the buffer at the current point.
 \\[hexl-insert-decimal-char] will insert a given decimal value (if it is between 0 and 255)
 into the buffer at the current point.
 
-\\[hexl-mode-exit] will exit hexl-mode.
+\\[hexl-mode-exit] will exit `hexl-mode'.
 
 Note: saving the file with any of the usual Emacs commands
 will actually convert it back to binary format while saving.
@@ -395,8 +395,8 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
     (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t)
 
     ;; Set a callback function for eldoc.
-    (hexl-mode--setq-local 'eldoc-documentation-function
-                           #'hexl-print-current-point-info)
+    (add-function :before-until (local 'eldoc-documentation-function)
+                  #'hexl-print-current-point-info)
     (eldoc-add-command-completions "hexl-")
     (eldoc-remove-command "hexl-save-buffer"
                          "hexl-current-address")
@@ -406,7 +406,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
 
 
 (defun hexl-isearch-search-function ()
-  (if (and (not isearch-regexp) (not isearch-word))
+  (if (and (not isearch-regexp) (not isearch-regexp-function))
       (lambda (string &optional bound noerror count)
        (funcall
         (if isearch-forward 're-search-forward 're-search-backward)
@@ -566,7 +566,7 @@ This function is intended to be used as eldoc callback."
     (format "Current address is %d/0x%08x" addr addr)))
 
 (defun hexl-ascii-start-column ()
-  "Column at which the ascii portion of the hexl display starts."
+  "Column at which the ASCII portion of the hexl display starts."
   (+ 43 (/ 128 hexl-bits)))
 
 (defun hexl-address-to-marker (address)
@@ -587,7 +587,7 @@ Signal error if ADDRESS is out of range."
   (goto-char (hexl-address-to-marker address)))
 
 (defun hexl-goto-hex-address (hex-address)
-  "Go to hexl-mode address (hex string) HEX-ADDRESS.
+  "Go to Hexl mode address (hex string) HEX-ADDRESS.
 Signal error if HEX-ADDRESS is out of range."
   (interactive "sHex Address: ")
   (hexl-goto-address (hexl-hex-string-to-integer hex-address)))
@@ -616,17 +616,17 @@ Signal error if HEX-ADDRESS is out of range."
 ;; move point functions
 
 (defun hexl-backward-char (arg)
-  "Move to left ARG bytes (right if ARG negative) in hexl-mode."
+  "Move to left ARG bytes (right if ARG negative) in Hexl mode."
   (interactive "p")
   (hexl-goto-address (- (hexl-current-address) arg)))
 
 (defun hexl-forward-char (arg)
-  "Move to right ARG bytes (left if ARG negative) in hexl-mode."
+  "Move to right ARG bytes (left if ARG negative) in Hexl mode."
   (interactive "p")
   (hexl-goto-address (+ (hexl-current-address) arg)))
 
 (defun hexl-backward-short (arg)
-  "Move to left ARG shorts (right if ARG negative) in hexl-mode."
+  "Move to left ARG shorts (right if ARG negative) in Hexl mode."
   (interactive "p")
   (hexl-goto-address (let ((address (hexl-current-address)))
                       (if (< arg 0)
@@ -658,12 +658,12 @@ Signal error if HEX-ADDRESS is out of range."
                       address)))
 
 (defun hexl-forward-short (arg)
-  "Move to right ARG shorts (left if ARG negative) in hexl-mode."
+  "Move to right ARG shorts (left if ARG negative) in Hexl mode."
   (interactive "p")
   (hexl-backward-short (- arg)))
 
 (defun hexl-backward-word (arg)
-  "Move to left ARG words (right if ARG negative) in hexl-mode."
+  "Move to left ARG words (right if ARG negative) in Hexl mode."
   (interactive "p")
   (hexl-goto-address (let ((address (hexl-current-address)))
                       (if (< arg 0)
@@ -695,18 +695,18 @@ Signal error if HEX-ADDRESS is out of range."
                       address)))
 
 (defun hexl-forward-word (arg)
-  "Move to right ARG words (left if ARG negative) in hexl-mode."
+  "Move to right ARG words (left if ARG negative) in Hexl mode."
   (interactive "p")
   (hexl-backward-word (- arg)))
 
 (defun hexl-previous-line (arg)
-  "Move vertically up ARG lines [16 bytes] (down if ARG negative) in hexl-mode.
+  "Move vertically up ARG lines [16 bytes] (down if ARG negative) in Hexl mode.
 If there is no byte at the target address move to the last byte in that line."
   (interactive "p")
   (hexl-next-line (- arg)))
 
 (defun hexl-next-line (arg)
-  "Move vertically down ARG lines [16 bytes] (up if ARG negative) in hexl-mode.
+  "Move vertically down ARG lines [16 bytes] (up if ARG negative) in Hexl mode.
 If there is no byte at the target address move to the last byte in that line."
   (interactive "p")
   (hexl-goto-address (let ((address (+ (hexl-current-address) (* arg 16))))
@@ -740,12 +740,12 @@ With prefix arg N, puts point N bytes of the way from the true beginning."
   (hexl-goto-address (- hexl-max-address (1- arg))))
 
 (defun hexl-beginning-of-line ()
-  "Goto beginning of line in hexl mode."
+  "Goto beginning of line in Hexl mode."
   (interactive)
   (goto-char (+ (* (/ (point) (hexl-line-displen)) (hexl-line-displen)) 11)))
 
 (defun hexl-end-of-line ()
-  "Goto end of line in hexl mode."
+  "Goto end of line in Hexl mode."
   (interactive)
   (hexl-goto-address (let ((address (logior (hexl-current-address) 15)))
                       (if (> address hexl-max-address)
@@ -935,13 +935,14 @@ and their encoded form is inserted byte by byte."
                     (mapconcat (function (lambda (c) (format "%x" c)))
                                internal " "))
               (if (yes-or-no-p
-                   (format
+                   (format-message
                     "Insert char 0x%x's internal representation \"%s\"? "
                     ch internal-hex))
                   (setq encoded internal)
                 (error
-                 "Can't encode `0x%x' with this buffer's coding system; try \\[hexl-insert-hex-string]"
-                 ch)))
+                 "Can't encode `0x%x' with this buffer's coding system; %s"
+                 ch
+                 (substitute-command-keys "try \\[hexl-insert-hex-string]"))))
             (while (> num 0)
               (mapc
                (function (lambda (c) (hexl-insert-char c 1))) encoded)
@@ -1100,7 +1101,7 @@ This function is assumed to be used as callback function for `hl-line-mode'."
     ))
 
 (defun hexl-mode-ruler ()
-  "Return a string ruler for hexl mode."
+  "Return a string ruler for Hexl mode."
   (let* ((highlight (mod (hexl-current-address) 16))
         (s (cdr (assq hexl-bits hexl-rulers)))
         (pos 0))