From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.bugs Subject: bug#8196: 23.1; Feature request with code: "C-x TAB" to understand tab-stop-list Date: Sun, 14 Jul 2013 17:41:14 +0300 Message-ID: <87zjtp2ohh.fsf@mithlond.arda> References: <87d3m2equ6.fsf@imladris.arda> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1373812935 23176 80.91.229.3 (14 Jul 2013 14:42:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Jul 2013 14:42:15 +0000 (UTC) Cc: 8196@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 14 16:42:15 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UyNV5-0004rq-1o for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2013 16:42:11 +0200 Original-Received: from localhost ([::1]:39351 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyNV4-0007SQ-G5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2013 10:42:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyNUz-0007Rr-29 for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2013 10:42:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyNUw-0002ue-N2 for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2013 10:42:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyNUw-0002uZ-JB for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2013 10:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UyNUw-0003Qm-6c for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2013 10:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Teemu Likonen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Jul 2013 14:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8196 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8196-submit@debbugs.gnu.org id=B8196.137381288313083 (code B ref 8196); Sun, 14 Jul 2013 14:42:02 +0000 Original-Received: (at 8196) by debbugs.gnu.org; 14 Jul 2013 14:41:23 +0000 Original-Received: from localhost ([127.0.0.1]:54035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyNUI-0003Ov-Pk for submit@debbugs.gnu.org; Sun, 14 Jul 2013 10:41:23 -0400 Original-Received: from mta-out.inet.fi ([195.156.147.13]:46839 helo=jenni1.inet.fi) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyNUE-0003Of-7Z for 8196@debbugs.gnu.org; Sun, 14 Jul 2013 10:41:19 -0400 Original-Received: from mithlond.arda (84.251.134.110) by jenni1.inet.fi (8.5.140.03) id 5163EC5606A47981; Sun, 14 Jul 2013 17:41:15 +0300 Original-Received: from dtw by mithlond.arda with local (Exim 4.80) (envelope-from ) id 1UyNUA-0004AI-D6; Sun, 14 Jul 2013 17:41:14 +0300 In-Reply-To: (Stefan Monnier's message of "Sat, 13 Jul 2013 16:02:35 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:76345 Archived-At: Stefan Monnier [2013-07-13 16:02:35 -04:00] wrote: > This said, there's another good default behavior for non-prefixed C-x > TAB which is to enter an interactive loop that lets the user move the > block left/right with the cursor keys. I think this would be a more > useful change. Sounds good. I wrote a quick example command "tl-edit-indentation". It works like "indent-rigidly" expect that when there is no prefix argument it sets a temporary repeatable overlay keyboard with the cursor keys for editing indentation. Plain and would move by 1 column and and move by tab stops. I like this feature. (defun tl-region-indentation (beg end) "Return the smallest indentation in range from BEG to END. Blank lines are ignored." (save-excursion (save-match-data (let ((beg (progn (goto-char beg) (line-beginning-position))) indent) (goto-char beg) (while (re-search-forward "^\\s-*[[:print:]]" end t) (setq indent (min (or indent (current-indentation)) (current-indentation)))) indent)))) (defun tl-edit-indentation (start end arg) (interactive "r\nP") (if arg (indent-rigidly start end (prefix-numeric-value arg)) (message "Edit region indentation with , , \ and .") (set-temporary-overlay-map (let ((map (make-sparse-keymap))) (define-key map (kbd "") (lambda () (interactive) (indent-rigidly (region-beginning) (region-end) -1))) (define-key map (kbd "") (lambda () (interactive) (indent-rigidly (region-beginning) (region-end) 1))) (define-key map (kbd "") (lambda () (interactive) (let* ((beg (region-beginning)) (end (region-end)) (current (tl-region-indentation beg end)) (next (catch 'answer (dolist (col tab-stop-list (1+ current)) (when (> col current) (throw 'answer col)))))) (indent-rigidly beg end (- next current))))) (define-key map (kbd "") (lambda () (interactive) (let* ((beg (region-beginning)) (end (region-end)) (current (tl-region-indentation beg end)) (next (catch 'answer (dolist (col (reverse tab-stop-list) 0) (when (< col current) (throw 'answer col)))))) (indent-rigidly beg end (- next current))))) map) t)))