mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Add commands to move to next/previous column in tabulated-list-mode
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map): Add keybindings M-left and M-right. (tabulated-list-previous-column tabulated-list-next-column): Implement commands (bug#44711).
This commit is contained in:
parent
f04f8126f0
commit
a6afa221d7
2 changed files with 27 additions and 0 deletions
3
etc/NEWS
3
etc/NEWS
|
|
@ -2331,6 +2331,9 @@ previously no easy way to get back to the original displayed order
|
||||||
after sorting, but giving a -1 numerical prefix to the sorting command
|
after sorting, but giving a -1 numerical prefix to the sorting command
|
||||||
will now restore the original order.
|
will now restore the original order.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** 'M-left' and 'M-right' now move between columns in 'tabulated-list-mode'.
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** New utility function 'insert-into-buffer'.
|
*** New utility function 'insert-into-buffer'.
|
||||||
This is like 'insert-buffer-substring', but works in the opposite
|
This is like 'insert-buffer-substring', but works in the opposite
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,8 @@ If ADVANCE is non-nil, move forward by one line afterwards."
|
||||||
special-mode-map))
|
special-mode-map))
|
||||||
(define-key map "n" 'next-line)
|
(define-key map "n" 'next-line)
|
||||||
(define-key map "p" 'previous-line)
|
(define-key map "p" 'previous-line)
|
||||||
|
(define-key map (kbd "M-<left>") 'tabulated-list-previous-column)
|
||||||
|
(define-key map (kbd "M-<right>") 'tabulated-list-next-column)
|
||||||
(define-key map "S" 'tabulated-list-sort)
|
(define-key map "S" 'tabulated-list-sort)
|
||||||
(define-key map "}" 'tabulated-list-widen-current-column)
|
(define-key map "}" 'tabulated-list-widen-current-column)
|
||||||
(define-key map "{" 'tabulated-list-narrow-current-column)
|
(define-key map "{" 'tabulated-list-narrow-current-column)
|
||||||
|
|
@ -740,6 +742,28 @@ Interactively, N is the prefix numeric argument, and defaults to
|
||||||
(setq-local tabulated-list--current-lnum-width lnum-width)
|
(setq-local tabulated-list--current-lnum-width lnum-width)
|
||||||
(tabulated-list-init-header)))))
|
(tabulated-list-init-header)))))
|
||||||
|
|
||||||
|
(defun tabulated-list-next-column (&optional arg)
|
||||||
|
"Go to the start of the next column after point on the current line.
|
||||||
|
If ARG is provided, move that many columns."
|
||||||
|
(interactive "p")
|
||||||
|
(dotimes (_ (or arg 1))
|
||||||
|
(let ((next (or (next-single-property-change
|
||||||
|
(point) 'tabulated-list-column-name)
|
||||||
|
(point-max))))
|
||||||
|
(when (<= next (line-end-position))
|
||||||
|
(goto-char next)))))
|
||||||
|
|
||||||
|
(defun tabulated-list-previous-column (&optional arg)
|
||||||
|
"Go to the start of the column point is in on the current line.
|
||||||
|
If ARG is provided, move that many columns."
|
||||||
|
(interactive "p")
|
||||||
|
(dotimes (_ (or arg 1))
|
||||||
|
(let ((prev (or (previous-single-property-change
|
||||||
|
(point) 'tabulated-list-column-name)
|
||||||
|
1)))
|
||||||
|
(unless (< prev (line-beginning-position))
|
||||||
|
(goto-char prev)))))
|
||||||
|
|
||||||
;;; The mode definition:
|
;;; The mode definition:
|
||||||
|
|
||||||
(defvar tabulated-list--original-order nil)
|
(defvar tabulated-list--original-order nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue