emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Matt Lundin <mdl@imapmail.org>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Fix moving cursor in org-set-tags-command
Date: Fri, 08 May 2020 09:53:55 +0200	[thread overview]
Message-ID: <87ftca6ewc.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <871rnvi8g6.fsf@fastmail.fm> (Matt Lundin's message of "Thu, 07 May 2020 19:20:09 -0500")

Hello,

Matt Lundin <mdl@imapmail.org> 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.

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.

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.

Regards,

-- 
Nicolas Goaziou


  parent reply	other threads:[~2020-05-08  7:54 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 [this message]
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

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=87ftca6ewc.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.org \
    --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).