Ignore direct input when at the start of an Org headline
This is to guard headlines to become invalid due to my erratic (mis)typing behavior.
This commit is contained in:
parent
def778595d
commit
96f00fb630
15
init.el
15
init.el
@ -646,6 +646,7 @@
|
||||
db/org-execute-babel-in-buffer-and-iterate-tables
|
||||
db/make-org-capture-frame
|
||||
db/org-cleanup-continuous-clocks
|
||||
db/org-update-headline-log-note
|
||||
db/find-csv-in-org
|
||||
db/export-diary
|
||||
db/org-insert-checklist
|
||||
@ -675,6 +676,7 @@
|
||||
db/org-mark-current-default-task
|
||||
db/org-clocktable-write-with-threshold
|
||||
org-dblock-write:db/org-backlinks
|
||||
db/org-ignore-insert-on-headline-start
|
||||
org-password-manager-get-password-by-id
|
||||
db/org-bookmark-open
|
||||
db/org-bookmark-store-link
|
||||
@ -744,10 +746,9 @@
|
||||
"%80ITEM(Task) %10Effort(Effort) %10CLOCKSUM"
|
||||
|
||||
;; We activate speed keys primarily to avoid invalidating headlines by accidentally
|
||||
;; typing non-star characters when at the start of a headline.
|
||||
org-use-speed-commands #'(lambda ()
|
||||
(and (looking-at org-outline-regexp)
|
||||
(looking-back "^\\**" nil))))
|
||||
;; typing non-star characters when at the start of a headline. See
|
||||
;; `db/org-ignore-insert-on-headline-start'.
|
||||
org-use-speed-commands t)
|
||||
|
||||
;; Keywords and Tags
|
||||
|
||||
@ -920,7 +921,11 @@
|
||||
;; Completely redo agenda buffer when jumping to today; this ensures that agenda views
|
||||
;; from previous days get updated as expected.
|
||||
(define-advice org-agenda-goto-today (:before () redo-all)
|
||||
(org-agenda-redo-all))))
|
||||
(org-agenda-redo-all))
|
||||
|
||||
;; Inhibit direct input when point is at the beginning of a headline, i.e., before the
|
||||
;; first space that separates the stars from the content of the headline.
|
||||
(add-to-list 'org-speed-command-hook 'db/org-ignore-insert-on-headline-start)))
|
||||
|
||||
(use-package org-cycle
|
||||
:autoload (org-cycle-hide-drawers)
|
||||
|
||||
@ -1243,6 +1243,20 @@ cache if that's in use."
|
||||
(when (derived-mode-p 'org-agenda-mode)
|
||||
(org-agenda-redo)))
|
||||
|
||||
(defun db/org-ignore-insert-on-headline-start (keys)
|
||||
"Return error function when point is at the stars of a headline.
|
||||
|
||||
This function is meant to be added to `org-speed-command-hook'. KEYS is
|
||||
ignored.
|
||||
|
||||
The implementat has been adapted from `org-speed-command-activate' to
|
||||
ignore all keys pressed at the beginning of a headline."
|
||||
(ignore keys)
|
||||
(when (and (looking-at org-outline-regexp)
|
||||
(looking-back "^\\**" nil))
|
||||
#'(lambda ()
|
||||
(user-error "No direct input allowed in headline"))))
|
||||
|
||||
(defun org-password-manager-get-password-by-id (id &optional return-as-value)
|
||||
"Retrieve password from Org item identified by ID.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user