diff options
| author | Zach Shaftel | 2020-06-05 15:06:29 -0400 |
|---|---|---|
| committer | Zach Shaftel | 2020-06-05 15:06:29 -0400 |
| commit | 629d1790ede73d859c503354f2beb1316cf7df8f (patch) | |
| tree | aec67496beeb5ff5544280bc7947d64587274bab | |
| parent | 0c45e51b6a36ae5664fd357c7499ae66bfcd7fd4 (diff) | |
| download | emacs-629d1790ede73d859c503354f2beb1316cf7df8f.tar.gz emacs-629d1790ede73d859c503354f2beb1316cf7df8f.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.el | 13 |
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) |