From: Matthew Lundin <mdl@imapmail.org> To: Nicolas Goaziou <mail@nicolasgoaziou.fr> Cc: Org Mode List <emacs-orgmode@gnu.org> Subject: Re: [PATCH] Fix moving cursor in org-set-tags-command Date: Sun, 10 May 2020 12:39:37 -0500 [thread overview] Message-ID: <87o8qvaduu.fsf@fastmail.fm> (raw) In-Reply-To: <87ftca6ewc.fsf@nicolasgoaziou.fr> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > >> - (when (save-excursion (skip-chars-backward "*") (bolp)) >> - (forward-char)))) >> + (and (looking-at " ") >> + (string-match "\\*+" (buffer-substring (point-at-bol) (point))) >> + (forward-char)))) > > Please replace `and' with `when' if side-effects are involved. > Thanks, this is really helpful to know for future patches. And thanks so much for the fixes you and Kyle made. > Also, note that > > (save-excursion (skip-chars-backward "*") (bolp)) > > is faster and more accurate than > > (string-match "\\*+" (buffer-substring (point-at-bol) (point))) > > because the latter matches, e.g., > > ab*|c > > where "|" is point. Oops, yes I see the problem in the string-match there! > Besides, I don't understand how this is related to empty headlines > since, AFAICT, this part of code is supposed to fix the issue on empty > headlines. Thanks. What I meant was fixing a very specific circumstance "when the cursor is at the beginning of an empty headline." This is the scenario affected by the original bug. The earlier patches (450452de4b and 44ec473c1) introduced a more general logic of moving the cursor forward at any point before the beginning of an empty headline (including when positioned on an asterisk). I see the commit has already been made, so hopefully this email will serve as clarification. Best, Matt
prev parent reply other threads:[~2020-05-10 17:40 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-08 0:20 Matt Lundin 2020-05-08 2:42 ` Kyle Meyer 2020-05-08 7:53 ` Nicolas Goaziou 2020-05-09 1:44 ` Kyle Meyer 2020-05-09 8:12 ` Nicolas Goaziou 2020-05-09 20:01 ` Kyle Meyer 2020-05-10 17:39 ` Matthew Lundin [this message]
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: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style 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=87o8qvaduu.fsf@fastmail.fm \ --to=mdl@imapmail.org \ --cc=emacs-orgmode@gnu.org \ --cc=mail@nicolasgoaziou.fr \ --subject='Re: [PATCH] Fix moving cursor in org-set-tags-command' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this 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).