* tab binding for hs-minor mode
@ 2011-04-18 11:28 A Soare
0 siblings, 0 replies; only message in thread
From: A Soare @ 2011-04-18 11:28 UTC (permalink / raw)
To: emacs-devel
;; called once on a line that contains a hidden block, shows the
;; block; otherwise calls the default action of TAB; called twice on a
;; line that does not contain a hidden block, hide the block from the
;; current position of the cursor
(defun tab-hs-hide ( &optional arg )
(interactive "P")
(let ((sl (save-excursion (move-beginning-of-line nil) (point) ) )
(el (save-excursion (move-end-of-line nil) (point) ) )
obj)
(catch 'stop
(dotimes (i (- el sl))
(mapc
(lambda (overlay)
(when (eq 'hs (overlay-get overlay 'invisible))
(setq obj t)))
(overlays-at (+ i sl)))
(and obj (throw 'stop 'stop) ) ) )
(cond ((and (null obj)
(eq last-command this-command) )
(hs-hide-block) )
(obj
(progn
(move-beginning-of-line nil)
(hs-show-block) ) )
(t
(save-excursion
(funcall (lookup-key (current-global-map) (kbd "^I") ) arg ) ) ) ) ) )
(define-key hs-minor-mode-map [tab] 'tab-hs-hide )
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-18 11:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 11:28 tab binding for hs-minor mode A 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).