Compare commits
2 Commits
159c8c0eb6
...
eafebe1cb9
Author | SHA1 | Date |
---|---|---|
Daniel - | eafebe1cb9 | |
Daniel - | cedaae00e8 |
|
@ -603,18 +603,23 @@ query for it."
|
||||||
(save-mark-and-excursion
|
(save-mark-and-excursion
|
||||||
(let ((template-element (org-with-point-at pom
|
(let ((template-element (org-with-point-at pom
|
||||||
(org-element-at-point))))
|
(org-element-at-point))))
|
||||||
;; Starting from the end of the last element in the subtree,
|
|
||||||
;; we go up until we find a drawer or a headline; everything
|
|
||||||
;; in between is considered to be the body.
|
|
||||||
(let ((content-end (org-element-property :contents-end template-element))
|
(let ((content-end (org-element-property :contents-end template-element))
|
||||||
content-begin current-element)
|
current-element
|
||||||
(goto-char content-end)
|
content-begin)
|
||||||
(while (progn
|
;; Start finding the beginning of the template contents from the top …
|
||||||
(setq current-element (org-element-at-point))
|
(goto-char (org-element-property :contents-begin template-element))
|
||||||
(not (memq (org-element-type current-element)
|
;; … but skip any drawers we may find.
|
||||||
'(drawer property-drawer headline))))
|
(setq current-element (org-element-at-point))
|
||||||
(setq content-begin (org-element-property :begin current-element))
|
(while (memq (org-element-type current-element)
|
||||||
(goto-char (1- content-begin)))
|
'(drawer property-drawer))
|
||||||
|
(goto-char (org-element-property :end current-element))
|
||||||
|
(setq current-element (org-element-at-point)))
|
||||||
|
;; Now we are at the beginning of the contents, let's copy
|
||||||
|
;; that, but only if it exists and is not empty.
|
||||||
|
(setq content-begin (org-element-property :begin current-element))
|
||||||
|
(unless (and content-begin
|
||||||
|
(< content-begin content-end))
|
||||||
|
(user-error "Cannot find content in template, or content is empty"))
|
||||||
(string-trim-right
|
(string-trim-right
|
||||||
(buffer-substring-no-properties content-begin content-end))))))))
|
(buffer-substring-no-properties content-begin content-end))))))))
|
||||||
(insert body)
|
(insert body)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
(require 'calc-forms)
|
(require 'calc-forms)
|
||||||
(require 'ert)
|
(require 'ert)
|
||||||
(require 's)
|
(require 's)
|
||||||
|
(require 'shr)
|
||||||
|
|
||||||
(autoload 'async-start "async")
|
(autoload 'async-start "async")
|
||||||
(autoload 'lispy-mode "lispy")
|
(autoload 'lispy-mode "lispy")
|
||||||
|
@ -454,6 +455,13 @@ Does not replace CRLF with CRCRLF, and so on."
|
||||||
(file-exists-p (concat project "/.git"))))
|
(file-exists-p (concat project "/.git"))))
|
||||||
projectile-known-projects))))
|
projectile-known-projects))))
|
||||||
|
|
||||||
|
(defun db/shr-render-file (file)
|
||||||
|
"Display the HTML rending of the contents of FILE."
|
||||||
|
(interactive "f")
|
||||||
|
(unless (file-readable-p file)
|
||||||
|
(user-error "Cannot read file: %s" file))
|
||||||
|
(shr-render-buffer (find-file-noselect file)))
|
||||||
|
|
||||||
|
|
||||||
;; Base45 Decoding
|
;; Base45 Decoding
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue