From: Tassilo Horn <tassilo@member.fsf.org>
To: Thien-Thi Nguyen <ttn@gnuvola.org>
Cc: emacs-devel@gnu.org
Subject: Re: suggestion for tab keybinding in hideshow minor mode.
Date: Fri, 03 Dec 2010 09:11:44 +0100 [thread overview]
Message-ID: <874oav1dj3.fsf@member.fsf.org> (raw)
In-Reply-To: <87tyiv3foe.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Fri, 03 Dec 2010 00:42:25 +0100")
Thien-Thi Nguyen <ttn@gnuvola.org> writes:
> () Tassilo Horn <tassilo@member.fsf.org>
> () Thu, 02 Dec 2010 18:28:56 +0100
>
> (let ((obj (car (overlays-in
> (save-excursion (move-beginning-of-line nil) (point))
> (save-excursion (move-end-of-line nil) (point))))))
> ...)
>
> See also ‘line-beginning-position’, ‘line-end-position’,
Yeah, first I've replaced the above with exactly those, but the behavior
was different. When I've hidden an inner block and then an outer block
(like, a function definition with an inner for loop), I was unable to
show it again.
I suspect that `line-beginning-position' and `line-end-position'
consider "real" lines, whereas the move-functions mean visible lines.
In a hidden block {...} the open brace is not on the same real line than
the closing one.
> ‘hs-already-hidden-p’, ‘hs-overlay-at’.
Yep, that makes it much simpler:
--8<---------------cut here---------------start------------->8---
(eval-after-load 'hideshow
;; Use TAB to toggle hiding/showing a block.
'(progn
(define-context-key hs-minor-mode-map
(kbd "TAB")
(and (not (hs-already-hidden-p))
(eq last-command this-command))
hs-hide-block)
(define-context-key hs-minor-mode-map
(kbd "TAB")
hs-already-hidden-p
hs-show-block)))
--8<---------------cut here---------------end--------------->8---
Thanks for the hint!
Tassilo
next prev parent reply other threads:[~2010-12-03 8:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-02 13:43 suggestion for tab keybinding in hideshow minor mode alin soare
2010-12-02 17:28 ` Tassilo Horn
2010-12-02 23:42 ` Thien-Thi Nguyen
2010-12-03 8:11 ` Tassilo Horn [this message]
2010-12-06 15:02 ` Alin Soare
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874oav1dj3.fsf@member.fsf.org \
--to=tassilo@member.fsf.org \
--cc=emacs-devel@gnu.org \
--cc=ttn@gnuvola.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.