* [patch] When inserting entry template, don't include last newline in narrowed zone
@ 2020-06-28 10:14 E.L.K.
2020-06-28 11:17 ` E.L.K.
2020-06-28 16:28 ` Kyle Meyer
0 siblings, 2 replies; 3+ messages in thread
From: E.L.K. @ 2020-06-28 10:14 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 544 bytes --]
Hello.
Org 9.3.6: when inserting the entry by capture mechanics, it narrows buffer
in a way that cursor can be moved to the last line, which is the beginning
of next (non-capture template) line in the original unnarowed buffer.
So this allows to: start capture, move point to the very last char of the
narrowed buffer, insert something. If this line in unnarowed buffer was
start of heading, it breaks structure of document.
This is patch in attempt to fix it. I followed same approach as in
org-capture-place-item function.
Thanks,
Alexey
[-- Attachment #1.2: Type: text/html, Size: 692 bytes --]
[-- Attachment #2: dont-include-last-newline-in-the-insert-template-narrowing.patch --]
[-- Type: text/x-patch, Size: 785 bytes --]
Common subdirectories: org-9.3.6/etc and /home/elk/.emacs.d/elpa/org-9.3.6/etc
diff -U5 org-9.3.6/org-capture.el /home/elk/.emacs.d/elpa/org-9.3.6/org-capture.el
--- org-9.3.6/org-capture.el 2020-06-15 19:04:19.061012833 +0300
+++ /home/elk/.emacs.d/elpa/org-9.3.6/org-capture.el 2020-06-28 13:08:04.446045559 +0300
@@ -1149,11 +1149,11 @@
(org-paste-subtree level template 'for-yank))
(org-capture-position-for-last-stored beg)
(org-capture-empty-lines-after)
(unless (org-at-heading-p) (outline-next-heading))
(org-capture-mark-kill-region origin (point))
- (org-capture-narrow beg (point))
+ (org-capture-narrow beg (1- (point)))
(when (or (search-backward "%?" beg t)
(search-forward "%?" nil t))
(replace-match ""))))))
(defun org-capture-place-item ()
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] When inserting entry template, don't include last newline in narrowed zone
2020-06-28 10:14 [patch] When inserting entry template, don't include last newline in narrowed zone E.L.K.
@ 2020-06-28 11:17 ` E.L.K.
2020-06-28 16:28 ` Kyle Meyer
1 sibling, 0 replies; 3+ messages in thread
From: E.L.K. @ 2020-06-28 11:17 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 789 bytes --]
Just found an issue with this patch: if I try to schedule the item,
SCHEDULED and timestamp get inserted into invisible area.
Thanks,
Alexey
On Sun, Jun 28, 2020 at 1:14 PM E.L.K. <some.any.key@gmail.com> wrote:
> Hello.
>
> Org 9.3.6: when inserting the entry by capture mechanics, it narrows
> buffer in a way that cursor can be moved to the last line, which is the
> beginning of next (non-capture template) line in the original unnarowed
> buffer.
>
> So this allows to: start capture, move point to the very last char of the
> narrowed buffer, insert something. If this line in unnarowed buffer was
> start of heading, it breaks structure of document.
>
> This is patch in attempt to fix it. I followed same approach as in
> org-capture-place-item function.
>
> Thanks,
> Alexey
>
[-- Attachment #2: Type: text/html, Size: 1259 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] When inserting entry template, don't include last newline in narrowed zone
2020-06-28 10:14 [patch] When inserting entry template, don't include last newline in narrowed zone E.L.K.
2020-06-28 11:17 ` E.L.K.
@ 2020-06-28 16:28 ` Kyle Meyer
1 sibling, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2020-06-28 16:28 UTC (permalink / raw)
To: E.L.K., emacs-orgmode
E.L.K. writes:
> Hello.
>
> Org 9.3.6: when inserting the entry by capture mechanics, it narrows buffer
> in a way that cursor can be moved to the last line, which is the beginning
> of next (non-capture template) line in the original unnarowed buffer.
>
> So this allows to: start capture, move point to the very last char of the
> narrowed buffer, insert something. If this line in unnarowed buffer was
> start of heading, it breaks structure of document.
>
> This is patch in attempt to fix it. I followed same approach as in
> org-capture-place-item function.
Thanks. AFAICT this issue, along with the hidden SCHEDULE line you
mention in the next commit, is resolved on the master branch (what will
be v9.4). The last commit in this area is 6882478ca (capture: Fix
org-capture-place-entry narrow bounds, 2020-05-29).
> Common subdirectories: org-9.3.6/etc and /home/elk/.emacs.d/elpa/org-9.3.6/etc
> diff -U5 org-9.3.6/org-capture.el /home/elk/.emacs.d/elpa/org-9.3.6/org-capture.el
> --- org-9.3.6/org-capture.el 2020-06-15 19:04:19.061012833 +0300
> +++ /home/elk/.emacs.d/elpa/org-9.3.6/org-capture.el 2020-06-28 13:08:04.446045559 +0300
For future reference: This doesn't quite match this project's
conventions for patch submissions. More information is here:
<https://orgmode.org/worg/org-contribute.html>.
Thanks again.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-28 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-28 10:14 [patch] When inserting entry template, don't include last newline in narrowed zone E.L.K.
2020-06-28 11:17 ` E.L.K.
2020-06-28 16:28 ` Kyle Meyer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).