From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: alin soare Newsgroups: gmane.emacs.devel Subject: suggestion for tab keybinding in hideshow minor mode. Date: Thu, 2 Dec 2010 13:43:27 +0000 (UTC) Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1291303950 6306 80.91.229.12 (2 Dec 2010 15:32:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Dec 2010 15:32:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 02 16:32:25 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1POB8x-0001Fh-Mz for ged-emacs-devel@m.gmane.org; Thu, 02 Dec 2010 16:32:24 +0100 Original-Received: from localhost ([127.0.0.1]:37163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POB8w-0007PK-Vo for ged-emacs-devel@m.gmane.org; Thu, 02 Dec 2010 10:32:23 -0500 Original-Received: from [140.186.70.92] (port=52541 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO9S8-00010S-7B for emacs-devel@gnu.org; Thu, 02 Dec 2010 08:44:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PO9Rn-0004YW-PJ for emacs-devel@gnu.org; Thu, 02 Dec 2010 08:44:03 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:57324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PO9Rn-0004XQ-HP for emacs-devel@gnu.org; Thu, 02 Dec 2010 08:43:43 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PO9Rj-0004yu-AN for emacs-devel@gnu.org; Thu, 02 Dec 2010 14:43:39 +0100 Original-Received: from 82-76-35-107.rdsnet.ro ([82-76-35-107.rdsnet.ro]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Dec 2010 14:43:39 +0100 Original-Received: from as1789 by 82-76-35-107.rdsnet.ro with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Dec 2010 14:43:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 82.76.35.107 (Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133311 Archived-At: 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 )