summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-05-16 09:52:53 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-05-16 09:52:53 +0100
commita96731d7f0f0616e500583a1d3eaa912a7f0ec16 (patch)
tree0e7f01ca4de0b3eb0cf9d4668cbb5f28d504a25a /lisp/emacs-lisp
parente85053f8fecd2124450a4e27d629cf87cf508319 (diff)
downloademacs-a96731d7f0f0616e500583a1d3eaa912a7f0ec16.tar.gz
emacs-a96731d7f0f0616e500583a1d3eaa912a7f0ec16.tar.bz2
emacs-a96731d7f0f0616e500583a1d3eaa912a7f0ec16.zip
* lisp/emacs-lisp/tabulated-list.el: Don't error on nil header-string
(tabulated-list-init-header): Document new behavior. (tabulated-list-print-fake-header): No nothing if `tabulated-list--header-string' is nil. (tabulated-list--header-string): Add a docstring. * doc/lispref/modes.texi (Tabulated List Mode): Document it. * etc/NEWS: Document it.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/tabulated-list.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index b12edc8c595..5d10b55d14c 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -179,7 +179,9 @@ If ADVANCE is non-nil, move forward by one line afterwards."
table)
"The `glyphless-char-display' table in Tabulated List buffers.")
-(defvar tabulated-list--header-string nil)
+(defvar tabulated-list--header-string nil
+ "Holds the header if `tabulated-list-use-header-line' is nil.
+Populated by `tabulated-list-init-header'.")
(defvar tabulated-list--header-overlay nil)
(defun tabulated-list-init-header ()
@@ -243,15 +245,17 @@ If ADVANCE is non-nil, move forward by one line afterwards."
(setq-local tabulated-list--header-string cols))))
(defun tabulated-list-print-fake-header ()
- "Insert a fake Tabulated List \"header line\" at the start of the buffer."
- (goto-char (point-min))
- (let ((inhibit-read-only t))
- (insert tabulated-list--header-string "\n")
- (if tabulated-list--header-overlay
- (move-overlay tabulated-list--header-overlay (point-min) (point))
- (setq-local tabulated-list--header-overlay
- (make-overlay (point-min) (point))))
- (overlay-put tabulated-list--header-overlay 'face 'underline)))
+ "Insert a fake Tabulated List \"header line\" at the start of the buffer.
+Do nothing if `tabulated-list--header-string' is nil."
+ (when tabulated-list--header-string
+ (goto-char (point-min))
+ (let ((inhibit-read-only t))
+ (insert tabulated-list--header-string "\n")
+ (if tabulated-list--header-overlay
+ (move-overlay tabulated-list--header-overlay (point-min) (point))
+ (setq-local tabulated-list--header-overlay
+ (make-overlay (point-min) (point))))
+ (overlay-put tabulated-list--header-overlay 'face 'underline))))
(defun tabulated-list-revert (&rest ignored)
"The `revert-buffer-function' for `tabulated-list-mode'.