summaryrefslogtreecommitdiff
path: root/lisp/hexl.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-06-02 10:25:50 -0700
committerGlenn Morris <rgm@gnu.org>2018-06-02 10:25:50 -0700
commit42a851c6347bb45a2fb8acdb0d2a1ca468ecefd3 (patch)
treebfd595460df8864956639fecc13636a94d413212 /lisp/hexl.el
parent4a7e74fea687011ee81dcbb02294bccd99b3a05f (diff)
parentca3f0a8343c125a44845d21808ab0e35b87533db (diff)
downloademacs-42a851c6347bb45a2fb8acdb0d2a1ca468ecefd3.tar.gz
emacs-42a851c6347bb45a2fb8acdb0d2a1ca468ecefd3.tar.bz2
emacs-42a851c6347bb45a2fb8acdb0d2a1ca468ecefd3.zip
Merge from origin/emacs-26
ca3f0a8 ; * etc/NEWS: Belated announcement of 2 changes made in Emacs... 99f92da Improve documentation of 'directory-files-and-attributes' df8649a * lisp/gnus/message.el (message-remove-header): Don't remove ... b682a7e ; * etc/NEWS: Add headings for Emacs 26.2 aa175a4 Adapt hexl-mode to native line-number display b8e7749 Fix example in Tramp manual f212fe5 Handle case where Xft is found but not XRender 186280f * doc/misc/tramp.texi (Frequently Asked Questions): Adapt zsh... 24ba633 Improve read-multiple-choice docstring (Bug#31628) Conflicts: etc/NEWS src/dired.c
Diffstat (limited to 'lisp/hexl.el')
-rw-r--r--lisp/hexl.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/hexl.el b/lisp/hexl.el
index d716405f97a..2c1a7de48a7 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -1104,8 +1104,15 @@ This function is assumed to be used as callback function for `hl-line-mode'."
"Return a string ruler for Hexl mode."
(let* ((highlight (mod (hexl-current-address) 16))
(s (cdr (assq hexl-bits hexl-rulers)))
- (pos 0))
+ (pos 0)
+ (lnum-width
+ (if display-line-numbers
+ (round (line-number-display-width 'columns))
+ 0)))
(set-text-properties 0 (length s) nil s)
+ (when (> lnum-width 0)
+ (setq s (concat (make-string lnum-width ? ) s))
+ (setq pos (+ pos lnum-width)))
;; Turn spaces in the header into stretch specs so they work
;; regardless of the header-line face.
(while (string-match "[ \t]+" s pos)
@@ -1116,10 +1123,11 @@ This function is assumed to be used as callback function for `hl-line-mode'."
s))
;; Highlight the current column.
(let ( (offset (+ (* 2 highlight) (/ (* 8 highlight) hexl-bits))) )
+ (if (> lnum-width 0) (setq offset (+ offset lnum-width)))
(put-text-property (+ 11 offset) (+ 13 offset) 'face 'highlight s))
;; Highlight the current ascii column
- (put-text-property (+ (hexl-ascii-start-column) highlight 1)
- (+ (hexl-ascii-start-column) highlight 2)
+ (put-text-property (+ (hexl-ascii-start-column) lnum-width highlight 1)
+ (+ (hexl-ascii-start-column) lnum-width highlight 2)
'face 'highlight s)
s))