forked from mirrors/org-mode
Factor out org-scroll and use it in ox.el, org-agenda/attach.el
* lisp/ox.el (org-export--dispatch-ui): Update message in the header line to promote the use of C-v and M-v while SPC and DEL are still allowed for backward compatibility reasons. * lisp/org-macs.el (org-scroll): New function. * lisp/org-attach.el (org-attach): Use `org-scroll'. * lisp/org-agenda.el (org-agenda-get-restriction-and-command): Allow C-v, M-v, C-n and C-p to scroll. This change adverize C-v, M-v, C-n and C-p as the default keys for scrolling the window, while SPC and DEL are still available in the export dispatch window. In particular, don't use SPC as a way to scroll the window in the agenda commands dispatch window, as this key might be used for a custom agenda command.
This commit is contained in:
parent
185e184e15
commit
2508dfa644
|
@ -3119,7 +3119,7 @@ s Search for keywords M Like m, but only TODO entries
|
||||||
;; Hint to navigation if window too small for all information
|
;; Hint to navigation if window too small for all information
|
||||||
(setq header-line-format
|
(setq header-line-format
|
||||||
(when (not (pos-visible-in-window-p (point-max)))
|
(when (not (pos-visible-in-window-p (point-max)))
|
||||||
"Use SPC, DEL, C-n or C-p to navigate."))
|
"Use C-v, M-v, C-n or C-p to navigate."))
|
||||||
|
|
||||||
;; Ask for selection
|
;; Ask for selection
|
||||||
(cl-loop
|
(cl-loop
|
||||||
|
@ -3133,7 +3133,7 @@ s Search for keywords M Like m, but only TODO entries
|
||||||
" (unrestricted)"))
|
" (unrestricted)"))
|
||||||
""))
|
""))
|
||||||
(setq c (read-char-exclusive)))
|
(setq c (read-char-exclusive)))
|
||||||
until (not (memq c '(14 16 ?\s ?\d)))
|
until (not (memq c '(14 16 22 134217846)))
|
||||||
do (org-scroll c))
|
do (org-scroll c))
|
||||||
|
|
||||||
(message "")
|
(message "")
|
||||||
|
|
|
@ -263,7 +263,7 @@ Shows a list of commands and prompts for another key to execute a command."
|
||||||
(switch-to-buffer-other-window (get-buffer-create "*Org Attach*"))
|
(switch-to-buffer-other-window (get-buffer-create "*Org Attach*"))
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(setq cursor-type nil
|
(setq cursor-type nil
|
||||||
header-line-format "Use SPC, DEL, C-n or C-p to navigate.")
|
header-line-format "Use C-v, M-v, C-n or C-p to navigate.")
|
||||||
(insert
|
(insert
|
||||||
(concat "Attachment folder:\n"
|
(concat "Attachment folder:\n"
|
||||||
(or dir
|
(or dir
|
||||||
|
@ -290,16 +290,12 @@ Shows a list of commands and prompts for another key to execute a command."
|
||||||
"\n")))))
|
"\n")))))
|
||||||
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
|
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
|
||||||
(let ((msg (format "Select command: [%s]"
|
(let ((msg (format "Select command: [%s]"
|
||||||
(concat (mapcar #'caar org-attach-commands)))))
|
(concat (mapcar #'caar org-attach-commands))))
|
||||||
|
key)
|
||||||
(message msg)
|
(message msg)
|
||||||
(setq c (read-char-exclusive))
|
(while (and (setq key (read-char-exclusive prompt))
|
||||||
(while (memq c '(14 16 32 127))
|
(memq key '(14 16 22 134217846)))
|
||||||
(cond ((= c 14) (ignore-errors (call-interactively 'scroll-up-line)))
|
(org-scroll key t)))
|
||||||
((= c 16) (ignore-errors (call-interactively 'scroll-down-line)))
|
|
||||||
((= c 32) (ignore-errors (call-interactively 'scroll-up)))
|
|
||||||
((= c 127) (ignore-errors (call-interactively 'scroll-down))))
|
|
||||||
(message msg)
|
|
||||||
(setq c (read-char-exclusive))))
|
|
||||||
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
|
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
|
||||||
(let ((command (cl-some (lambda (entry)
|
(let ((command (cl-some (lambda (entry)
|
||||||
(and (memq c (nth 0 entry)) (nth 1 entry)))
|
(and (memq c (nth 0 entry)) (nth 1 entry)))
|
||||||
|
|
|
@ -1202,9 +1202,15 @@ Return 0. if S is not recognized as a valid value."
|
||||||
((string-match org-ts-regexp0 s) (org-2ft s))
|
((string-match org-ts-regexp0 s) (org-2ft s))
|
||||||
(t 0.)))))
|
(t 0.)))))
|
||||||
|
|
||||||
(defun org-scroll (key)
|
(defun org-scroll (key &optional additional-keys)
|
||||||
"Receive KEY and scroll the current window accordingly."
|
"Receive KEY and scroll the current window accordingly.
|
||||||
(cl-case key
|
When ADDITIONAL-KEYS is not nil, also include SPC and DEL in the
|
||||||
|
allowed keys for scrolling, as expected in the export dispatch
|
||||||
|
window."
|
||||||
|
(let ((scrlup (if additional-keys '(?\s 22) 22))
|
||||||
|
(scrldn (if additional-keys `(?\d 134217846) 134217846)))
|
||||||
|
(eval
|
||||||
|
`(case ,key
|
||||||
;; C-n
|
;; C-n
|
||||||
(14 (if (not (pos-visible-in-window-p (point-max)))
|
(14 (if (not (pos-visible-in-window-p (point-max)))
|
||||||
(ignore-errors (scroll-up 1))
|
(ignore-errors (scroll-up 1))
|
||||||
|
@ -1215,18 +1221,17 @@ Return 0. if S is not recognized as a valid value."
|
||||||
(ignore-errors (scroll-down 1))
|
(ignore-errors (scroll-down 1))
|
||||||
(message "Beginning of buffer")
|
(message "Beginning of buffer")
|
||||||
(sit-for 1)))
|
(sit-for 1)))
|
||||||
;; SPC
|
;; SPC or
|
||||||
(?\s (if (not (pos-visible-in-window-p (point-max)))
|
(,scrlup
|
||||||
|
(if (not (pos-visible-in-window-p (point-max)))
|
||||||
(scroll-up nil)
|
(scroll-up nil)
|
||||||
(message "End of buffer")
|
(message "End of buffer")
|
||||||
(sit-for 1)))
|
(sit-for 1)))
|
||||||
;; DEL
|
;; DEL
|
||||||
(?\d (if (not (pos-visible-in-window-p (point-min)))
|
(,scrldn (if (not (pos-visible-in-window-p (point-min)))
|
||||||
(scroll-down nil)
|
(scroll-down nil)
|
||||||
(message "Beginning of buffer")
|
(message "Beginning of buffer")
|
||||||
(sit-for 1)))))
|
(sit-for 1)))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'org-macs)
|
(provide 'org-macs)
|
||||||
|
|
||||||
|
|
|
@ -6864,7 +6864,7 @@ back to standard interface."
|
||||||
(org-switch-to-buffer-other-window
|
(org-switch-to-buffer-other-window
|
||||||
(get-buffer-create "*Org Export Dispatcher*"))
|
(get-buffer-create "*Org Export Dispatcher*"))
|
||||||
(setq cursor-type nil
|
(setq cursor-type nil
|
||||||
header-line-format "Use SPC, DEL, C-n or C-p to navigate.")
|
header-line-format "Use C-v, M-v, C-n or C-p to navigate.")
|
||||||
;; Make sure that invisible cursor will not highlight square
|
;; Make sure that invisible cursor will not highlight square
|
||||||
;; brackets.
|
;; brackets.
|
||||||
(set-syntax-table (copy-syntax-table))
|
(set-syntax-table (copy-syntax-table))
|
||||||
|
@ -6901,7 +6901,7 @@ options as CDR."
|
||||||
(while (and (setq key (read-char-exclusive prompt))
|
(while (and (setq key (read-char-exclusive prompt))
|
||||||
(not expertp)
|
(not expertp)
|
||||||
(memq key '(14 16 ?\s ?\d)))
|
(memq key '(14 16 ?\s ?\d)))
|
||||||
(org-scroll key))
|
(org-scroll key t))
|
||||||
(cond
|
(cond
|
||||||
;; Ignore undefined associations.
|
;; Ignore undefined associations.
|
||||||
((not (memq key allowed-keys))
|
((not (memq key allowed-keys))
|
||||||
|
|
Loading…
Reference in New Issue