;;; tabulated-list.el --- generic major mode for tabulated lists -*- lexical-binding: t -*-
-;; Copyright (C) 2011-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
;; Author: Chong Yidong <cyd@stupidchicken.com>
;; Keywords: extensions, lisp
(sorter (tabulated-list--get-sorter))
entry-id saved-pt saved-col window-line)
(and remember-pos
+ (setq entry-id (tabulated-list-get-id))
+ (setq saved-col (current-column))
(when (eq (window-buffer) (current-buffer))
(setq window-line
- (count-screen-lines (window-start) (point))))
- (setq entry-id (tabulated-list-get-id))
- (setq saved-col (current-column)))
+ (count-screen-lines (window-start) (point)))))
;; Sort the entries, if necessary.
(when sorter
(setq entries (sort entries sorter)))
nil)
;; If this entry sorts after id (or it's the
;; end), then just insert id and move on.
- ((funcall sorter elt
- ;; FIXME: Might be faster if
- ;; don't construct this list.
- (list local-id (tabulated-list-get-entry)))
+ ((or (not local-id)
+ (funcall sorter elt
+ ;; FIXME: Might be faster if
+ ;; don't construct this list.
+ (list local-id (tabulated-list-get-entry))))
(apply tabulated-list-printer elt)
nil)
;; We find an entry that sorts before id,
(car (aref tabulated-list-format n))
(get-text-property (point)
'tabulated-list-column-name))))
- (tabulated-list--sort-by-column-name name)))
+ (if (nth 2 (assoc name (append tabulated-list-format nil)))
+ (tabulated-list--sort-by-column-name name)
+ (user-error "Cannot sort by %s" name))))
(defun tabulated-list--sort-by-column-name (name)
(when (and name (derived-mode-p 'tabulated-list-mode))
that calls `ewoc-enter-last'), with `tabulated-list-print-entry'
as the ewoc pretty-printer."
(setq-local truncate-lines t)
- (setq-local buffer-read-only t)
(setq-local buffer-undo-list t)
(setq-local revert-buffer-function #'tabulated-list-revert)
(setq-local glyphless-char-display tabulated-list-glyphless-char-display)
(provide 'tabulated-list)
-;; Local Variables:
-;; coding: utf-8
-;; End:
-
;;; tabulated-list.el ends here