From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] emacs: skip forward to visible text in notmuch-show-message-extent
Date: Tue, 05 Jul 2011 13:38:03 +0400 [thread overview]
Message-ID: <87iprh5apw.fsf@gmail.com> (raw)
In-Reply-To: <1309667286-10357-2-git-send-email-dmitry.kurochkin@gmail.com>
On Sun, 3 Jul 2011 08:28:06 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> The patch rewrites `notmuch-show-message-extent' to be more
> robust. The main goal is to make it work as expected if point is
> invisible. Besides, there are no more point movements and
> property search functions are used instead manual loops. The
> comment regarding properties strangeness is removed since there
> is no strangeness here: property ranges (as well as overlay, and
> many others, I believe) are given as [begin, end), not [begin,
> end].
Please do not apply this patch. I am considering a different solution:
instead of making the trailing newline invisible, make the preceding
newline invisible. This way a message would always have a visible
newline at the end and it would prevent `beginning-of-visual-line' going
beyond the beginning of message.
FYI there is a discussion on emacs-devel [1] regarding point adjustment
inside invisible regions.
Regards,
Dmitry
[1] http://thread.gmane.org/gmane.emacs.devel/141479
> ---
> emacs/notmuch-show.el | 19 +++++++++++--------
> 1 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index f96743b..cf8b405 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -933,15 +933,18 @@ All currently available key bindings:
>
> ;; Movement related functions.
>
> -;; There's some strangeness here where a text property applied to a
> -;; region a->b is not found when point is at b. We walk backwards
> -;; until finding the property.
> (defun notmuch-show-message-extent ()
> - (let (r)
> - (save-excursion
> - (while (not (setq r (get-text-property (point) :notmuch-message-extent)))
> - (backward-char)))
> - r))
> + (let ((p (point)))
> + ;; if point is invisible, skip forward to visible text
> + (while (invisible-p p)
> + (setq p (next-single-char-property-change p 'invisible)))
> + ;; if no visible text found, use the point
> + (or p (setq p (point)))
> + (or (get-text-property p :notmuch-message-extent)
> + ;; if there is no text property, skip to the previous message
> + (and (setq p (previous-single-char-property-change
> + p :notmuch-message-extent))
> + (get-text-property p :notmuch-message-extent)))))
>
> (defun notmuch-show-message-top ()
> (car (notmuch-show-message-extent)))
> --
> 1.7.5.4
>
prev parent reply other threads:[~2011-07-05 9:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-03 4:28 [PATCH 1/2] test: add emacs test for hiding message when point is at invisible text Dmitry Kurochkin
2011-07-03 4:28 ` [PATCH 2/2] emacs: skip forward to visible text in notmuch-show-message-extent Dmitry Kurochkin
2011-07-04 8:25 ` Pieter Praet
2011-07-05 9:38 ` Dmitry Kurochkin [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://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iprh5apw.fsf@gmail.com \
--to=dmitry.kurochkin@gmail.com \
--cc=notmuch@notmuchmail.org \
/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
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
https://yhetil.org/notmuch.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).