emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: add automatically a counter to a header/TODO???


From: Uwe Brauer
Subject: Re: add automatically a counter to a header/TODO???
Date: Mon, 01 Nov 2021 20:53:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:

> Hi

> I am using a poor man's issue system
> the org file in question has header of the form.




> ** WAIT \eqref{eq:section5-blowup:1} is referred as an item not an equation!
>    :PROPERTIES:
>    :ID:       Issues
>    :Date:     <2021-11-01 lun>
>    :STATUS:   [ ]
>    :Is:       11
>    :END:

> I was wondering whether 

>     - I could automatically insert in the HEADER a counter like 
>     ** WAIT 1: \eqref{eq:section5-blowup:1} is referred as an item not 
>     an equation
>    - or in the drawer like this 

> ** WAIT \eqref{eq:section5-blowup:1} is referred as an item not an equation!
>    :PROPERTIES:
>    :ID:       Issues
>    :Date:     <2021-11-01 lun>
>    :STATUS:   [ ]
>    :Is:       automatically inserted
>    :END:

I found an answer in
https://stackoverflow.com/questions/27937446/how-to-vote-for-a-heading-in-org-mode

Which works nicely although 

(add-to-list 'org-speed-commands-user '("+" . (plusone)))

Is no longer valid, so I bound that function just to another key.

One question remains: is there any way to take the counter down?

(defun plusone ()
  "Increase the VOTES property in an org-heading by one. Create
the property if needed."
  (interactive)
  (org-entry-put
   (point)
   "VOTES"
   (format "%s" (+ 1 (string-to-number
              (or
               (org-entry-get (point) "VOTES")
               "0"))))))


The genius in me, though 

   (format "%s" (- 1 (string-to-number

Would do that but it does not, strange, 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]