Improvements to speed commands
- Never leave headlines - Add a working key for org-agenda (v) - Allow org-use-speed-commands to be a predicate
This commit is contained in:
parent
f97bbde3c6
commit
6bf3010061
|
@ -1,3 +1,13 @@
|
||||||
|
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
|
* org.el (org-use-speed-commands): Allow function value.
|
||||||
|
(org-speed-commands-default): Make headline motion safe, so that
|
||||||
|
these commands always end on a headline.
|
||||||
|
(org-speed-commands-default): New key `v' for `org-agenda'.
|
||||||
|
(org-speed-move-safe): New function.
|
||||||
|
(org-self-insert-command): Use the function value of
|
||||||
|
`org-use-speed-commands'.
|
||||||
|
|
||||||
2009-11-12 John Wiegley <jwiegley@gmail.com>
|
2009-11-12 John Wiegley <jwiegley@gmail.com>
|
||||||
|
|
||||||
* org-clock.el (org-clock-resolve): If `org-clock-into-string' is
|
* org-clock.el (org-clock-resolve): If `org-clock-into-string' is
|
||||||
|
|
40
lisp/org.el
40
lisp/org.el
|
@ -594,9 +594,14 @@ new-frame Make a new frame each time. Note that in this case
|
||||||
(const :tag "One dedicated frame" dedicated-frame)))
|
(const :tag "One dedicated frame" dedicated-frame)))
|
||||||
|
|
||||||
(defcustom org-use-speed-commands nil
|
(defcustom org-use-speed-commands nil
|
||||||
"Non-nil means, activate single letter commands at beginning of a headline."
|
"Non-nil means, activate single letter commands at beginning of a headline.
|
||||||
|
This may also be a function to test for appropriate locations where speed
|
||||||
|
commands should be active."
|
||||||
:group 'org-structure
|
:group 'org-structure
|
||||||
:type 'boolean)
|
:type '(choice
|
||||||
|
(const :tag "Never")
|
||||||
|
(const :tag "At beginning of headline stars")
|
||||||
|
(function)))
|
||||||
|
|
||||||
(defcustom org-speed-commands-user nil
|
(defcustom org-speed-commands-user nil
|
||||||
"Alist of additional speed commands.
|
"Alist of additional speed commands.
|
||||||
|
@ -14829,11 +14834,12 @@ Some of the options can be changed using the variable
|
||||||
|
|
||||||
(defconst org-speed-commands-default
|
(defconst org-speed-commands-default
|
||||||
'(
|
'(
|
||||||
("n" . outline-next-visible-heading)
|
("n" . org-speed-move-safe)
|
||||||
("p" . outline-previous-visible-heading)
|
("p" . org-speed-move-safe)
|
||||||
("f" . org-forward-same-level)
|
("f" . org-speed-move-safe)
|
||||||
("b" . org-backward-same-level)
|
("b" . org-speed-move-safe)
|
||||||
("u" . outline-up-heading)
|
("u" . org-speed-move-safe)
|
||||||
|
(" " . org-display-outline-path)
|
||||||
|
|
||||||
("c" . org-cycle)
|
("c" . org-cycle)
|
||||||
("C" . org-shifttab)
|
("C" . org-shifttab)
|
||||||
|
@ -14846,7 +14852,7 @@ Some of the options can be changed using the variable
|
||||||
("i" . (progn (forward-char 1) (call-interactively
|
("i" . (progn (forward-char 1) (call-interactively
|
||||||
'org-insert-heading-respect-content)))
|
'org-insert-heading-respect-content)))
|
||||||
|
|
||||||
("a" . org-agenda)
|
("v" . org-agenda)
|
||||||
("/" . org-sparse-tree)
|
("/" . org-sparse-tree)
|
||||||
(";" . org-set-tags-command)
|
(";" . org-set-tags-command)
|
||||||
("I" . org-clock-in)
|
("I" . org-clock-in)
|
||||||
|
@ -14888,6 +14894,19 @@ Some of the options can be changed using the variable
|
||||||
(princ "\n")
|
(princ "\n")
|
||||||
(mapc 'org-print-speed-command org-speed-commands-default))))
|
(mapc 'org-print-speed-command org-speed-commands-default))))
|
||||||
|
|
||||||
|
(defun org-speed-move-safe ()
|
||||||
|
(interactive)
|
||||||
|
(let ((pos (point))
|
||||||
|
(tbl '(("n" . outline-next-visible-heading)
|
||||||
|
("p" . outline-previous-visible-heading)
|
||||||
|
("f" . org-forward-same-level)
|
||||||
|
("b" . org-backward-same-level)
|
||||||
|
("u" . outline-up-heading))))
|
||||||
|
(call-interactively (cdr (assoc (this-command-keys) tbl)))
|
||||||
|
(unless (and (bolp) (org-on-heading-p))
|
||||||
|
(goto-char pos)
|
||||||
|
(error "Boundary reached"))))
|
||||||
|
|
||||||
(defvar org-self-insert-command-undo-counter 0)
|
(defvar org-self-insert-command-undo-counter 0)
|
||||||
|
|
||||||
(defvar org-table-auto-blank-field) ; defined in org-table.el
|
(defvar org-table-auto-blank-field) ; defined in org-table.el
|
||||||
|
@ -14899,8 +14918,9 @@ overwritten, and the table is not marked as requiring realignment."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(cond
|
(cond
|
||||||
((and org-use-speed-commands
|
((and org-use-speed-commands
|
||||||
(bolp)
|
(or (and (bolp) (looking-at outline-regexp))
|
||||||
(looking-at outline-regexp)
|
(and (functionp org-use-speed-commands)
|
||||||
|
(funcall org-use-speed-commands)))
|
||||||
(setq
|
(setq
|
||||||
org-speed-command
|
org-speed-command
|
||||||
(or (cdr (assoc (this-command-keys) org-speed-commands-user))
|
(or (cdr (assoc (this-command-keys) org-speed-commands-user))
|
||||||
|
|
Loading…
Reference in New Issue