emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* align tags
@ 2008-10-03  8:22 henry atting
  2008-10-03 10:58 ` John Rakestraw
  0 siblings, 1 reply; 6+ messages in thread
From: henry atting @ 2008-10-03  8:22 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: align tags
  2008-10-03  8:22 align tags henry atting
@ 2008-10-03 10:58 ` John Rakestraw
  2008-10-03 15:08   ` henry atting
  0 siblings, 1 reply; 6+ messages in thread
From: John Rakestraw @ 2008-10-03 10:58 UTC (permalink / raw)
  To: emacs-orgmode

On Fri, 03 Oct 2008 10:22:48 +0200
henry atting <nspm_01@literaturlatenight.de> wrote:

> Is there a function which aligns tags in an org document?

Does C-u C-c C-c do what you want?

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: align tags
  2008-10-03 10:58 ` John Rakestraw
@ 2008-10-03 15:08   ` henry atting
  2008-10-03 16:00     ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: henry atting @ 2008-10-03 15:08 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode

Zitat - John Rakestraw * Fr Okt 03 2008 um 12:58 -

> On Fri, 03 Oct 2008 10:22:48 +0200
> henry atting <nspm_01@literaturlatenight.de> wrote:
>
>> Is there a function which aligns tags in an org document?
>
> Does C-u C-c C-c do what you want?

As far as I see it does what I want, but it an inconsistent way. I don't
understand it. 
Expample:

** <2008-10-18 Sa>This is what I do at that date			  :holiday:
** TODO And here what I have to do on an other 			       :schreiben:

The variable org-tags-column is set to -90. And when I set the cursor
behind any tag I get as resulting column 90. 

henry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: align tags
  2008-10-03 15:08   ` henry atting
@ 2008-10-03 16:00     ` Nick Dokos
  2008-10-03 17:00       ` henry atting
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2008-10-03 16:00 UTC (permalink / raw)
  To: henry atting; +Cc: emacs-orgmode

henry atting <nspm_01@literaturlatenight.de> wrote:

> Zitat - John Rakestraw * Fr Okt 03 2008 um 12:58 -
> 
> > On Fri, 03 Oct 2008 10:22:48 +0200
> > henry atting <nspm_01@literaturlatenight.de> wrote:
> >
> >> Is there a function which aligns tags in an org document?
> >
> > Does C-u C-c C-c do what you want?
> 
> As far as I see it does what I want, but it an inconsistent way. I don't
> understand it. 
> Expample:
> 
> ** <2008-10-18 Sa>This is what I do at that date			  :holiday:
> ** TODO And here what I have to do on an other 			       :schreiben:
> 
> The variable org-tags-column is set to -90. And when I set the cursor
> behind any tag I get as resulting column 90. 
> 

Maybe I'm missing the point but I don't see an inconsistency here.

Are the two tags aligned flush right in your org file? They are not in the mail
message, but I suspect that's a tab handling problem in the almost infinite chain
from your org file to my inbox, and not an org-mode problem.

If they *are* flush right, then I think everything is as it should be, no? The
documentation for the variable you mention says:

    The column to which tags should be indented in a headline.
    If this number is positive, it specifies the column.  If it is negative,
    it means that the tags should be flushright to that column.  For example,
    -80 works well for a normal 80 character screen.

That's exactly what I get: when I set it to -90, they are flush right ending
at column 90; when I set it to 90, they are flush left starting at column 90.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: align tags
  2008-10-03 16:00     ` Nick Dokos
@ 2008-10-03 17:00       ` henry atting
  2008-10-04  4:20         ` henry atting
  0 siblings, 1 reply; 6+ messages in thread
From: henry atting @ 2008-10-03 17:00 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: henry atting, emacs-orgmode

Zitat - Nick Dokos * Fr Okt 03 2008 um 18:00 -

> henry atting <nspm_01@literaturlatenight.de> wrote:
>
>> Zitat - John Rakestraw * Fr Okt 03 2008 um 12:58 -
>> 
>> > On Fri, 03 Oct 2008 10:22:48 +0200
>> > henry atting <nspm_01@literaturlatenight.de> wrote:
>> >
>> >> Is there a function which aligns tags in an org document?
>> >
>> > Does C-u C-c C-c do what you want?
>> 
>> As far as I see it does what I want, but it an inconsistent way. I don't
>> understand it. 
>> Expample:
>> 
>> ** <2008-10-18 Sa>This is what I do at that date			  :holiday:
>> ** TODO And here what I have to do on an other 			       :schreiben:
>> 
>> The variable org-tags-column is set to -90. And when I set the cursor
>> behind any tag I get as resulting column 90. 
>> 
>
> Maybe I'm missing the point but I don't see an inconsistency here.
>
> Are the two tags aligned flush right in your org file? They are not in the mail
> message, but I suspect that's a tab handling problem in the almost infinite chain
> from your org file to my inbox, and not an org-mode problem.

No, they aren't aligned flush right, the above example looks exactly
like the according part of an org file - I did not copy/paste it. 

> If they *are* flush right, then I think everything is as it should be, no? The
> documentation for the variable you mention says:
>
>     The column to which tags should be indented in a headline.
>     If this number is positive, it specifies the column.  If it is negative,
>     it means that the tags should be flushright to that column.  For example,
>     -80 works well for a normal 80 character screen.
>
> That's exactly what I get: when I set it to -90, they are flush right ending
> at column 90; when I set it to 90, they are flush left starting at column 90.

Same here, the tags end or start at column 90, but it *looks*
inconsistent. If I put the cursor behind `:holiday:' the column number
is 90, and if I put it behind `:schreiben:' it's 90, too.
If you look at the above example you wouldn't expect this.

henry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: align tags
  2008-10-03 17:00       ` henry atting
@ 2008-10-04  4:20         ` henry atting
  0 siblings, 0 replies; 6+ messages in thread
From: henry atting @ 2008-10-04  4:20 UTC (permalink / raw)
  To: henry atting; +Cc: emacs-orgmode

Zitat - henry atting * Fr Okt 03 2008 um 19:00 -

> Zitat - Nick Dokos * Fr Okt 03 2008 um 18:00 -
>
>> henry atting <nspm_01@literaturlatenight.de> wrote:
>>
>>> Zitat - John Rakestraw * Fr Okt 03 2008 um 12:58 -
>>> 
>>> > On Fri, 03 Oct 2008 10:22:48 +0200
>>> > henry atting <nspm_01@literaturlatenight.de> wrote:
>>> >
>>> >> Is there a function which aligns tags in an org document?
>>> >
>>> > Does C-u C-c C-c do what you want?
>>> 
>>> As far as I see it does what I want, but it an inconsistent way. I don't
>>> understand it. 
>>> Expample:
>>> 
>>> ** <2008-10-18 Sa>This is what I do at that date			  :holiday:
>>> ** TODO And here what I have to do on an other 			       :schreiben:
>>> 
>>> The variable org-tags-column is set to -90. And when I set the cursor
>>> behind any tag I get as resulting column 90. 
>>> 
>>
>> Maybe I'm missing the point but I don't see an inconsistency here.
>>
>> Are the two tags aligned flush right in your org file? They are not in the mail
>> message, but I suspect that's a tab handling problem in the almost infinite chain
>> from your org file to my inbox, and not an org-mode problem.
>
> No, they aren't aligned flush right, the above example looks exactly
> like the according part of an org file - I did not copy/paste it. 
>
>> If they *are* flush right, then I think everything is as it should be, no? The
>> documentation for the variable you mention says:
>>
>>     The column to which tags should be indented in a headline.
>>     If this number is positive, it specifies the column.  If it is negative,
>>     it means that the tags should be flushright to that column.  For example,
>>     -80 works well for a normal 80 character screen.
>>
>> That's exactly what I get: when I set it to -90, they are flush right ending
>> at column 90; when I set it to 90, they are flush left starting at column 90.
>
> Same here, the tags end or start at column 90, but it *looks*
> inconsistent. If I put the cursor behind `:holiday:' the column number
> is 90, and if I put it behind `:schreiben:' it's 90, too.
> If you look at the above example you wouldn't expect this.

Aah, and the culprit is: 

     #+STARTUP: customtime

I was experimenting with in-buffer settings, this one caused the tag
display inconsistency. Now, that I have removed it, everything works as
it should.

Thanks to all
henry

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-04  4:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-03  8:22 align tags henry atting
2008-10-03 10:58 ` John Rakestraw
2008-10-03 15:08   ` henry atting
2008-10-03 16:00     ` Nick Dokos
2008-10-03 17:00       ` henry atting
2008-10-04  4:20         ` henry atting

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).