Small refactoring
* lisp/org-macs.el (org-scroll): New function. * lisp/ox.el (org-export--dispatch-action): * lisp/org-agenda.el (org-agenda-get-restriction-and-command): Use the new function.
This commit is contained in:
parent
d9b586ce34
commit
ceb8086301
|
@ -3134,23 +3134,7 @@ s Search for keywords M Like m, but only TODO entries
|
||||||
""))
|
""))
|
||||||
(setq c (read-char-exclusive)))
|
(setq c (read-char-exclusive)))
|
||||||
until (not (memq c '(14 16 ?\s ?\d)))
|
until (not (memq c '(14 16 ?\s ?\d)))
|
||||||
do (cl-case c
|
do (org-scroll c))
|
||||||
(14 (if (not (pos-visible-in-window-p (point-max)))
|
|
||||||
(ignore-errors (scroll-up 1))
|
|
||||||
(message "End of buffer")
|
|
||||||
(sit-for 1)))
|
|
||||||
(16 (if (not (pos-visible-in-window-p (point-min)))
|
|
||||||
(ignore-errors (scroll-down 1))
|
|
||||||
(message "Beginning of buffer")
|
|
||||||
(sit-for 1)))
|
|
||||||
(?\s (if (not (pos-visible-in-window-p (point-max)))
|
|
||||||
(scroll-up nil)
|
|
||||||
(message "End of buffer")
|
|
||||||
(sit-for 1)))
|
|
||||||
(?\d (if (not (pos-visible-in-window-p (point-min)))
|
|
||||||
(scroll-down nil)
|
|
||||||
(message "Beginning of buffer")
|
|
||||||
(sit-for 1)))))
|
|
||||||
|
|
||||||
(message "")
|
(message "")
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -1202,6 +1202,30 @@ 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)
|
||||||
|
"Receive KEY and scroll the current window accordingly."
|
||||||
|
(cl-case key
|
||||||
|
;; C-n
|
||||||
|
(14 (if (not (pos-visible-in-window-p (point-max)))
|
||||||
|
(ignore-errors (scroll-up 1))
|
||||||
|
(message "End of buffer")
|
||||||
|
(sit-for 1)))
|
||||||
|
;; C-p
|
||||||
|
(16 (if (not (pos-visible-in-window-p (point-min)))
|
||||||
|
(ignore-errors (scroll-down 1))
|
||||||
|
(message "Beginning of buffer")
|
||||||
|
(sit-for 1)))
|
||||||
|
;; SPC
|
||||||
|
(?\s (if (not (pos-visible-in-window-p (point-max)))
|
||||||
|
(scroll-up nil)
|
||||||
|
(message "End of buffer")
|
||||||
|
(sit-for 1)))
|
||||||
|
;; DEL
|
||||||
|
(?\d (if (not (pos-visible-in-window-p (point-min)))
|
||||||
|
(scroll-down nil)
|
||||||
|
(message "Beginning of buffer")
|
||||||
|
(sit-for 1)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'org-macs)
|
(provide 'org-macs)
|
||||||
|
|
18
lisp/ox.el
18
lisp/ox.el
|
@ -6904,23 +6904,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)))
|
||||||
(cl-case key
|
(org-scroll key))
|
||||||
(14 (if (not (pos-visible-in-window-p (point-max)))
|
|
||||||
(ignore-errors (scroll-up 1))
|
|
||||||
(message "End of buffer")
|
|
||||||
(sit-for 1)))
|
|
||||||
(16 (if (not (pos-visible-in-window-p (point-min)))
|
|
||||||
(ignore-errors (scroll-down 1))
|
|
||||||
(message "Beginning of buffer")
|
|
||||||
(sit-for 1)))
|
|
||||||
(?\s (if (not (pos-visible-in-window-p (point-max)))
|
|
||||||
(scroll-up nil)
|
|
||||||
(message "End of buffer")
|
|
||||||
(sit-for 1)))
|
|
||||||
(?\d (if (not (pos-visible-in-window-p (point-min)))
|
|
||||||
(scroll-down nil)
|
|
||||||
(message "Beginning of buffer")
|
|
||||||
(sit-for 1)))))
|
|
||||||
(cond
|
(cond
|
||||||
;; Ignore undefined associations.
|
;; Ignore undefined associations.
|
||||||
((not (memq key allowed-keys))
|
((not (memq key allowed-keys))
|
||||||
|
|
Loading…
Reference in New Issue