瀏覽代碼

org-macs: Make org-mks window navigable when needed

* lisp/org-macs.el (org-mks): Activate keys for scrolling when the
whole text does not fit into the visible portion of the window.

https://orgmode.org/list/trinity-ac492dc8-9edb-46e6-871a-fdbb9eaa3116-1607796126691@3c-app-mailcom-bs06/
Marco Wahl 4 年之前
父節點
當前提交
01f57aa0df
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      lisp/org-macs.el

+ 8 - 2
lisp/org-macs.el

@@ -461,9 +461,15 @@ is selected, only the bare key is returned."
 		;; Display UI and let user select an entry or
 		;; a sub-level prefix.
 		(goto-char (point-min))
-		(unless (pos-visible-in-window-p (point-max))
-		  (org-fit-window-to-buffer))
+		(setq header-line-format nil)
+		(org-fit-window-to-buffer)
+		(unless (pos-visible-in-window-p (1- (point-max)))
+		  (setq header-line-format "Use C-n, C-p or C-v to navigate.")
+		  (setq allowed-keys (append allowed-keys '("\C-n" "\C-p" "\C-v"))))
 		(let ((pressed (org--mks-read-key allowed-keys prompt)))
+		  (while (and (member pressed '("\C-n" "\C-p" "\C-v")))
+		    (org-scroll (string-to-char pressed))
+		    (setq pressed (org--mks-read-key allowed-keys prompt)))
 		  (setq current (concat current pressed))
 		  (cond
 		   ((equal pressed "\C-g") (user-error "Abort"))