emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: Re: add automatically a counter to a header/TODO???
Date: Mon, 01 Nov 2021 20:53:46 +0100	[thread overview]
Message-ID: <87o8734ppx.fsf@mat.ucm.es> (raw)
In-Reply-To: 8735of69m5.fsf@mat.ucm.es

[-- Attachment #1: Type: text/plain, Size: 1590 bytes --]

>>> "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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

  reply	other threads:[~2021-11-01 20:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 17:58 add automatically a counter to a header/TODO??? Uwe Brauer
2021-11-01 19:53 ` Uwe Brauer [this message]
2021-11-02 11:23   ` Eric S Fraga
2021-11-03  8:06     ` Uwe Brauer
2021-11-03 20:20       ` Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8734ppx.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).