unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* suggestion for tab keybinding in hideshow minor mode.
@ 2010-12-02 13:43 alin soare
  2010-12-02 17:28 ` Tassilo Horn
  0 siblings, 1 reply; 5+ messages in thread
From: alin soare @ 2010-12-02 13:43 UTC (permalink / raw)
  To: emacs-devel

I suggest to reproduce the behavior of org-mode for the Tab key , when the hs
minor mode is active.

1. first tab on a narowed line shows the block
2. is the next key is also tab, to hide again
3. otherwise, to preserve the previous binding of the major mode.



(defun tab-hs-hide nil
  (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)))
		   (hs-show-block) )
		  (t
		   (funcall (lookup-key (current-global-map) (kbd "^I") ) ) ) ) ) )

(define-key hs-minor-mode-map [tab] 'tab-hs-hide )







^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-06 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).