emacs-devel
[Top][All Lists]
Advanced

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

Re: suggestion for tab keybinding in hideshow minor mode.


From: Alin Soare
Subject: Re: suggestion for tab keybinding in hideshow minor mode.
Date: Mon, 6 Dec 2010 17:02:20 +0200


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 )




reply via email to

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