From: Juanma Barranquero Date: Thu, 20 Jun 2013 11:57:33 +0000 (+0200) Subject: lisp/emacs-lisp/tabulated-list.el: Use defvar-local, setq-local. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2016^2~25 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=47199123698df3a14acb016c3869075b2d6012d5;p=emacs.git lisp/emacs-lisp/tabulated-list.el: Use defvar-local, setq-local. (tabulated-list-format): Fix typo. Declare with `defvar-local'. (tabulated-list-use-header-line, tabulated-list-entries) (tabulated-list-padding, tabulated-list-printer) (tabulated-list-sort-key): Declare with `defvar-local'. (tabulated-list-init-header, tabulated-list-print-fake-header): Use `setq-local'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1e2425a1d27..0a9187435f1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,17 @@ +2013-06-20 Juanma Barranquero + + * emacs-lisp/tabulated-list.el (tabulated-list-format): Fix typo. + Declare with `defvar-local'. + (tabulated-list-use-header-line, tabulated-list-entries) + (tabulated-list-padding, tabulated-list-printer) + (tabulated-list-sort-key): Declare with `defvar-local'. + (tabulated-list-init-header, tabulated-list-print-fake-header): + Use `setq-local'. + 2013-06-20 Michael Albinus - * arc-mode.el (archive-mode): Add `archive-write-file' - `write-contents-functions' to also for remote files. (Bug#14652) + * arc-mode.el (archive-mode): Add `archive-write-file' to + `write-contents-functions' also for remote files. (Bug#14652) 2013-06-20 Juanma Barranquero diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 5660ac8c4cc..6119cc80835 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -41,7 +41,7 @@ ;; major mode, switch back, and have the original Tabulated List data ;; still valid. See, for example, ebuff-menu.el. -(defvar tabulated-list-format nil +(defvar-local tabulated-list-format nil "The format of the current Tabulated List mode buffer. This should be a vector of elements (NAME WIDTH SORT . PROPS), where: @@ -58,17 +58,15 @@ where: of `tabulated-list-entries'. - PROPS is a plist of additional column properties. Currently supported properties are: - - `:right-align': if non-nil, the column should be right-aligned. + - `:right-align': If non-nil, the column should be right-aligned. - `:pad-right': Number of additional padding spaces to the right of the column (defaults to 1 if omitted).") -(make-variable-buffer-local 'tabulated-list-format) (put 'tabulated-list-format 'permanent-local t) -(defvar tabulated-list-use-header-line t +(defvar-local tabulated-list-use-header-line t "Whether the Tabulated List buffer should use a header line.") -(make-variable-buffer-local 'tabulated-list-use-header-line) -(defvar tabulated-list-entries nil +(defvar-local tabulated-list-entries nil "Entries displayed in the current Tabulated List buffer. This should be either a function, or a list. If a list, each element has the form (ID [DESC1 ... DESCN]), @@ -86,28 +84,25 @@ where: If `tabulated-list-entries' is a function, it is called with no arguments and must return a list of the above form.") -(make-variable-buffer-local 'tabulated-list-entries) (put 'tabulated-list-entries 'permanent-local t) -(defvar tabulated-list-padding 0 +(defvar-local tabulated-list-padding 0 "Number of characters preceding each Tabulated List mode entry. By default, lines are padded with spaces, but you can use the function `tabulated-list-put-tag' to change this.") -(make-variable-buffer-local 'tabulated-list-padding) (put 'tabulated-list-padding 'permanent-local t) (defvar tabulated-list-revert-hook nil "Hook run before reverting a Tabulated List buffer. This is commonly used to recompute `tabulated-list-entries'.") -(defvar tabulated-list-printer 'tabulated-list-print-entry +(defvar-local tabulated-list-printer 'tabulated-list-print-entry "Function for inserting a Tabulated List entry at point. It is called with two arguments, ID and COLS. ID is a Lisp object identifying the entry, and COLS is a vector of column descriptors, as documented in `tabulated-list-entries'.") -(make-variable-buffer-local 'tabulated-list-printer) -(defvar tabulated-list-sort-key nil +(defvar-local tabulated-list-sort-key nil "Sort key for the current Tabulated List mode buffer. If nil, no additional sorting is performed. Otherwise, this should be a cons cell (NAME . FLIP). @@ -115,7 +110,6 @@ NAME is a string matching one of the column names in `tabulated-list-format' (the corresponding SORT entry in `tabulated-list-format' then specifies how to sort). FLIP, if non-nil, means to invert the resulting sort.") -(make-variable-buffer-local 'tabulated-list-sort-key) (put 'tabulated-list-sort-key 'permanent-local t) (defsubst tabulated-list-get-id (&optional pos) @@ -246,7 +240,7 @@ If ADVANCE is non-nil, move forward by one line afterwards." (if tabulated-list-use-header-line (setq header-line-format cols) (setq header-line-format nil) - (set (make-local-variable 'tabulated-list--header-string) cols)))) + (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." @@ -255,8 +249,8 @@ If ADVANCE is non-nil, move forward by one line afterwards." (insert tabulated-list--header-string "\n") (if tabulated-list--header-overlay (move-overlay tabulated-list--header-overlay (point-min) (point)) - (set (make-local-variable 'tabulated-list--header-overlay) - (make-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) @@ -351,7 +345,7 @@ of column descriptors." (defun tabulated-list-print-col (n col-desc x) "Insert a specified Tabulated List entry at point. -N is the column number, COL-DESC is a column descriptor \(see +N is the column number, COL-DESC is a column descriptor (see `tabulated-list-entries'), and X is the column number at point. Return the column number after insertion." ;; TODO: don't truncate to `width' if the next column is align-right