From mboxrd@z Thu Jan 1 00:00:00 1970 From: henry atting Subject: align tags Date: Fri, 03 Oct 2008 10:22:48 +0200 Message-ID: <87bpy2gk9z.fsf@literaturlatenight.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Klfts-0005MZ-08 for emacs-orgmode@gnu.org; Fri, 03 Oct 2008 04:20:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Klftn-0005M1-6g for emacs-orgmode@gnu.org; Fri, 03 Oct 2008 04:20:35 -0400 Received: from [199.232.76.173] (port=46926 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Klftn-0005Ly-2E for emacs-orgmode@gnu.org; Fri, 03 Oct 2008 04:20:31 -0400 Received: from main.gmane.org ([80.91.229.2]:59171 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Klftn-0002Ov-63 for emacs-orgmode@gnu.org; Fri, 03 Oct 2008 04:20:31 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Klftj-0001Kw-4D for emacs-orgmode@gnu.org; Fri, 03 Oct 2008 08:20:27 +0000 Received: from port-92-195-227-62.dynamic.qsc.de ([92.195.227.62]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Oct 2008 08:20:27 +0000 Received: from nspm_01 by port-92-195-227-62.dynamic.qsc.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Oct 2008 08:20:27 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Is there a function which aligns tags in an org document? As I could not find on, I tried it with a slightly changed function from ledger.el: --8<---------------cut here---------------start------------->8--- (defun org-align (&optional column) (interactive "p") (if (= column 1) (setq column 95)) (while (search-forward ":" nil t) (backward-char) (let ((col (current-column)) (beg (point)) target-col len) (skip-chars-forward "-:a-zA-z") (setq len (- (point) beg)) (setq target-col (- column len)) (if (< col target-col) (progn (goto-char beg) (insert (make-string (- target-col col) ? ))) (move-to-column target-col) (if (looking-back " ") (delete-char (- col target-col)) (skip-chars-forward "^ \t") (delete-horizontal-space) (insert " "))) (forward-line)))) --8<---------------cut here---------------end--------------->8--- It only works half because numbers are also skipped forward. henry