Compare commits

..

No commits in common. "292c8fc89a47a3be0a1dda51807df8bc94a1cff8" and "3789a2b0e9e73ec096d34b18701851919d222748" have entirely different histories.

View File

@ -13,7 +13,6 @@
(require 'cl-lib) (require 'cl-lib)
(require 'org) (require 'org)
(require 'org-agenda) (require 'org-agenda)
(require 'org-capture)
(require 'org-clock) (require 'org-clock)
(require 'hydra) (require 'hydra)
(require 'db-customize) (require 'db-customize)
@ -23,7 +22,6 @@
(autoload 'which-function "which-func") (autoload 'which-function "which-func")
(autoload 'org-element-property "org-element") (autoload 'org-element-property "org-element")
(autoload 'db/org-agenda "db-utils")
(declare-function w32-shell-execute "w32fns.c") (declare-function w32-shell-execute "w32fns.c")
@ -114,7 +112,7 @@ deadlines."
(setq buffer-read-only t) (setq buffer-read-only t)
(message "")))) (message ""))))
(defun db/org-agenda-insert-active-filters (&optional _match) (defun db/org-agenda-insert-active-filters (&optional match)
"Insert string showing the current agenda filters. "Insert string showing the current agenda filters.
The filter display is added after the structural header. The filter display is added after the structural header.
@ -390,71 +388,6 @@ In ~%s~:
(advice-add 'org-capture-finalize (advice-add 'org-capture-finalize
:after #'db/delete-frame-if-capture) :after #'db/delete-frame-if-capture)
(defun db/org-convert-item-to-headline ()
"Convert list item around point to headline.
Search for the outermost list item enclosing point and convert it
to a Org headline. Use the first line of the item as actual
headline, and move the rest to the body of the headline. A
property CREATED is added with an inactive timestamp capturing
the current time.
The converted headline will be shown in a capture buffer for
further editing. After finishing this buffer, the final headline
will be stored in `db/org-default-refilefile'.
Note that the original list item will be deleted before the
capture buffer will open. If the buffer is aborted, the original
list item is _not_ restored. This has to be done using the undo
history of the buffer."
(interactive)
(let ((element (org-element-at-point))
last-seen-item)
;; Get outermost list item
(while element
(when (eq (org-element-type element) 'item)
(setq last-seen-item element))
(setq element (org-element-parent element)))
(unless last-seen-item
(user-error "Cannot find enclosing list item at point to convert to headline"))
;; Generate headline and store it somewhere
(let* ((body (buffer-substring-no-properties (org-element-contents-begin last-seen-item)
(org-element-end last-seen-item)))
(first-line-of-body (seq-take-while #'(lambda (x) (not (= x ?\n))) body))
(rest-of-body (string-trim (seq-drop-while #'(lambda (x) (not (= x ?\n))) body))))
;; Remove old entry first
(delete-region (org-element-begin last-seen-item)
(org-element-end last-seen-item))
;; Set up capture buffer
(org-capture-put :key "")
(org-capture-put :description "")
(org-capture-put :target '(file db/org-default-refile-file))
(org-capture-put :empty-lines-before 1)
(org-capture-put :empty-lines-after 1)
(org-capture-put :template (org-capture-fill-template
(format "* TODO [#B] %s
:PROPERTIES:
:CREATED: %%U
:END:
Via %%(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-string))).
%s
%%?"
first-line-of-body
rest-of-body)))
(org-capture-set-target-location)
(org-capture-place-template)
(indent-region (point-min) (point-max)))))
;;; Refiling ;;; Refiling
@ -583,7 +516,7 @@ clocked in."
(if at-current-clock-p (if at-current-clock-p
;; From `org-clock-get-clocked-time' ;; From `org-clock-get-clocked-time'
(floor (org-time-convert-to-integer (floor (org-time-convert-to-integer
(time-since org-clock-start-time)) (org-time-since org-clock-start-time))
60) 60)
0)))) 0))))
@ -1250,8 +1183,7 @@ clipboard as with `org-password-manager-get-password', which see.
Otherwise, the password is returned as value from this function Otherwise, the password is returned as value from this function
and can be used for further processing." and can be used for further processing."
(eval-when-compile (require 'org-password-manager)
(require 'org-password-manager))
(let ((pom (org-id-find id 'marker))) (let ((pom (org-id-find id 'marker)))
(unless (markerp pom) (unless (markerp pom)
(user-error "Cannot find item with id %s" id)) (user-error "Cannot find item with id %s" id))
@ -1916,24 +1848,25 @@ linking to any item."
;; nil without any possibility for a custom string. ;; nil without any possibility for a custom string.
(unwind-protect (unwind-protect
(progn (progn
(fset 'completing-read #'(lambda (prompt (fset 'completing-read #'(lambda (_prompt
table _table
&optional &optional
predicate _predicate
require-match _require-match
_initial-input _initial-input
hist _hist
def _def
inherit-input-method) _inherit-input-method)
(ignore _initial-input)
(funcall old-completing-read (funcall old-completing-read
prompt _prompt
table _table
predicate _predicate
require-match _require-match
initial-input initial-input
hist _hist
def _def
inherit-input-method))) _inherit-input-method)))
(org-refile-get-location nil default-buffer)) (org-refile-get-location nil default-buffer))
(fset 'completing-read old-completing-read)))) (fset 'completing-read old-completing-read))))
(pom (nth 3 target-pointer))) (pom (nth 3 target-pointer)))