aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Shaftel2020-06-05 15:06:29 -0400
committerrocky2020-06-26 20:05:11 -0400
commit58e112fe18abe48321a9a9b676d76fdb68ee833a (patch)
treeaec67496beeb5ff5544280bc7947d64587274bab
parentafa6a9733e5ce0dc169bc8059028f987e1f33d14 (diff)
downloademacs-58e112fe18abe48321a9a9b676d76fdb68ee833a.tar.gz
emacs-58e112fe18abe48321a9a9b676d76fdb68ee833a.zip
Properly align offset in backtrace
* lisp/emacs-lisp/backtrace.el (backtrace--print-flags): Use format width specifier to line up the flags and offset nicely.
-rw-r--r--lisp/emacs-lisp/backtrace.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index ac6b6492790..c3f2ff0cfec 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -257,7 +257,7 @@ frames where the source code location is known.")
257 map) 257 map)
258 "Local keymap for `backtrace-mode' buffers.") 258 "Local keymap for `backtrace-mode' buffers.")
259 259
260(defconst backtrace--flags-width 6 260(defconst backtrace--flags-width 7
261 "Width in characters of the flags for a backtrace frame.") 261 "Width in characters of the flags for a backtrace frame.")
262 262
263;;; Navigation and Text Properties 263;;; Navigation and Text Properties
@@ -747,12 +747,13 @@ property for use by navigation."
747 (let ((beg (point)) 747 (let ((beg (point))
748 (flag (plist-get (backtrace-frame-flags frame) :debug-on-exit)) 748 (flag (plist-get (backtrace-frame-flags frame) :debug-on-exit))
749 (source (plist-get (backtrace-frame-flags frame) :source-available)) 749 (source (plist-get (backtrace-frame-flags frame) :source-available))
750 (off (plist-get (backtrace-frame-flags frame) :bytecode-offset))) 750 (offset (plist-get (backtrace-frame-flags frame) :bytecode-offset))
751 ;; right justify and pad the offset (or the empty string)
752 (offset-format (format "%%%ds " (- backtrace--flags-width 3))))
751 (when (plist-get view :show-flags) 753 (when (plist-get view :show-flags)
752 (when source (insert ">")) 754 (insert (if source ">" " "))
753 (when flag (insert "*")) 755 (insert (if flag "*" " "))
754 (when off (insert (number-to-string off)))) 756 (insert (format offset-format (or offset ""))))
755 (insert (make-string (- backtrace--flags-width (- (point) beg)) ?\s))
756 (put-text-property beg (point) 'backtrace-section 'func))) 757 (put-text-property beg (point) 'backtrace-section 'func)))
757 758
758(defun backtrace--print-func-and-args (frame _view) 759(defun backtrace--print-func-and-args (frame _view)