emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vasilij Schneidermann <mail@vasilij.de>
To: emacs-orgmode@gnu.org
Subject: Bug: [PATCH] org-datetree-insert-line doesn't honor headline spacing customization [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]
Date: Thu, 3 Sep 2020 10:50:54 +0200	[thread overview]
Message-ID: <20200903085054.GA21638@odonien.localdomain> (raw)

[-- Attachment #1.1: Type: text/plain, Size: 5760 bytes --]

When doing org captures using the datetree format, newly added headlines
do not follow the value of `org-blank-before-new-entry'.  This seems to
be the fault of `org-datetree-insert-line' using `insert' as opposed to
`org-insert-heading' to do its work.  See the attachment for a proposed

Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22)
 of 2020-08-13
Package: Org mode version 9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)

current state:
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-enforce-todo-dependencies t
 org-time-stamp-rounding-minutes '(0 15)
 org-reveal-start-hook '(org-decrypt-entry)
 org-blocker-hook '(org-block-todo-from-checkboxes
 org-cycle-include-plain-lists 'integrate
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-show-all append local] 5]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-babel-show-result-all
                    append local]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-startup-indented t
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '(("pdf" . system) (auto-mode . emacs) (system . "xdg-open %s")
                 (t . system))
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
 org-export-backends '(ascii beamer html latex md)
 org-ellipsis 'org-ellipsis
 org-src-preserve-indentation t
 org-catch-invisible-edits 'error
 org-occur-hook '(org-first-headline-recenter)
 org-enforce-todo-checkbox-dependencies t
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
 org-speed-command-hook '(org-speed-command-activate
 org-capture-mode-hook '(evil-insert-state)
 org-M-RET-may-split-line nil
 org-return-follows-link t
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export
                        org-attach-export-link :complete org-attach-complete-link)
                       ("id" :follow org-id-open)
                       ("eww" :follow eww :store org-eww-store-link)
                       ("rmail" :follow org-rmail-open :store
                       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store org-irc-store-link
                        :export org-irc-export)
                       ("info" :follow org-info-open :export org-info-export
                        :store org-info-store-link)
                       ("gnus" :follow org-gnus-open :store org-gnus-store-link)
                       ("docview" :follow org-docview-open :export
                        org-docview-export :store org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store
                       ("bbdb" :follow org-bbdb-open :export org-bbdb-export
                        :complete org-bbdb-complete-link :store
                       ("w3m" :store org-w3m-store-link) ("file+sys")
                       ("file+emacs") ("shell" :follow org-link--open-shell)
                       ("news" :follow
                        #[257 "\301\300\302Q!\207" ["news" browse-url ":"] 5
                          "\n\n(fn URL)"]
                       ("mailto" :follow
                        #[257 "\301\300\302Q!\207" ["mailto" browse-url ":"] 5
                          "\n\n(fn URL)"]
                       ("https" :follow
                        #[257 "\301\300\302Q!\207" ["https" browse-url ":"] 5
                          "\n\n(fn URL)"]
                       ("http" :follow
                        #[257 "\301\300\302Q!\207" ["http" browse-url ":"] 5
                          "\n\n(fn URL)"]
                       ("ftp" :follow
                        #[257 "\301\300\302Q!\207" ["ftp" browse-url ":"] 5
                          "\n\n(fn URL)"]
                       ("help" :follow org-link--open-help)
                       ("file" :complete org-link-complete-file)
                       ("elisp" :follow org-link--open-elisp)
                       ("doi" :follow org-link--open-doi))
 org-capture-templates '(("j" "Journal" entry
                          (file+olp+datetree "~/org/journal.org.gpg")
                          "* %<%H:%M>\n\n%?" :empty-lines 1)
 org-link-elisp-confirm-function 'yes-or-no-p
 org-latex-packages-alist '(("" "tabu" t) ("" "minted" t) ("english" "babel" t))
 org-clock-into-drawer nil
 org-link-frame-setup '((file . find-file))
 org-directory "~/org/"
 org-default-notes-file "~/org/notes.org"

[-- Attachment #1.2: 0001-Use-org-insert-heading-to-add-new-heading.patch --]
[-- Type: text/plain, Size: 921 bytes --]

From b00f00b4493d369f6ce56075f1de77d65aca4fdd Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <mail@vasilij.de>
Date: Thu, 3 Sep 2020 10:47:04 +0200
Subject: [PATCH] Use org-insert-heading to add new heading

 lisp/org-datetree.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index ce91591f1..33e7c9304 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -185,8 +185,9 @@ inserted into the buffer."
 (defun org-datetree-insert-line (year &optional month day text)
   (delete-region (save-excursion (skip-chars-backward " \t\n") (point)) (point))
-  (insert "\n" (make-string org-datetree-base-level ?*) " \n")
-  (backward-char)
+  (org-insert-heading)
+  (while (> (org-current-level) 1)
+    (org-do-promote))
   (when month (org-do-demote))
   (when day (org-do-demote))
   (if text

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2020-09-03  9:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  8:50 Vasilij Schneidermann [this message]
2020-09-05 14:57 ` Bug: [PATCH] org-datetree-insert-line doesn't honor headline spacing customization [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)] Bastien
2020-09-08 20:18   ` Vasilij Schneidermann
2020-09-09  8:08     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903085054.GA21638@odonien.localdomain \
    --to=mail@vasilij.de \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).