emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

suggestion for tab keybinding in hideshow minor mode.


From: alin soare
Subject: suggestion for tab keybinding in hideshow minor mode.
Date: Thu, 2 Dec 2010 13:43:27 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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 )







reply via email to

[Prev in Thread] Current Thread [Next in Thread]