From: Alin Soare <as1789@gmail.com>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-devel@gnu.org
Subject: Re: suggestion for tab keybinding in hideshow minor mode.
Date: Mon, 6 Dec 2010 17:02:20 +0200 [thread overview]
Message-ID: <AANLkTim9sWY=AToYUDS9rjK3dRdJLbBzSB3M2iKMR9kE@mail.gmail.com> (raw)
In-Reply-To: <87ipzcqe1z.fsf@fastmail.fm>
[-- Attachment #1: Type: text/plain, Size: 878 bytes --]
I found a bug, here is the code again:
0. if the current line contains hidden text, it shows the block
1. otherwise, the first tab indents, and the second tab hides
2. afterwards, it switches hide/show
(defun tab-hs-hide ()
(interactive)
(let ((obj (car (overlays-in
(save-excursion (move-beginning-of-line nil ) (point) )
(save-excursion (move-end-of-line nil) (point) ) ) ) )
)
(cond ((and (null obj)
(eq last-command this-command) )
(hs-hide-block) )
((and (overlayp obj)
(eq 'hs (overlay-get obj 'invisible)))
(progn
(move-beginning-of-line nil)
(hs-show-block) ) )
(t
(funcall (lookup-key (current-global-map) (kbd "^I") ) ) ) ) )
)
(define-key hs-minor-mode-map [tab] 'tab-hs-hide )
[-- Attachment #2: Type: text/html, Size: 1140 bytes --]
prev parent reply other threads:[~2010-12-06 15:02 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
2010-12-06 15:02 ` Alin Soare [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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTim9sWY=AToYUDS9rjK3dRdJLbBzSB3M2iKMR9kE@mail.gmail.com' \
--to=as1789@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=tassilo@member.fsf.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://git.savannah.gnu.org/cgit/emacs.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).