:auto-sitemap in org-publish-project-alist

2020-09-25 Thread David Masterson
My org-publish-project-alist kind of looks like this:

(setq org-publish-project-alist
  '(("orgfiles"
 :base-directory "~/DSM/MyOrg/"
 :base-extension "org"
 :publishing-directory "~/Publish/html/"
 :publishing-function org-html-publish-to-html
 :headline-levels 6
 :section-numbers t
 :makeindex t
 :auto-sitemap t
 :exclude "init.org"
 :with-toc nil)))


If I publish my files, sitemap.org is made in a buffer and written to a
file,  Thereafter, org-publish always says sitemap.org has been changed
on disk and asks about updating it.  Since it is a generated file, that
shouldn't be necessary.

Is there a way to turn that off and just have it overwrite the file?

-- 
David Masterson



Re: Bug: Occasional error with recurring tasks in agenda [9.4 (release_9.4-3-ge6021b @ /home/james/.config/emacs/straight/build/org-plus-contrib/)]

2020-09-25 Thread Ihor Radchenko
> This doesn't happen with emacs -Q, so presumably there's something in my
> config that's making this happen, but I have no idea what I should be
> looking for. Any suggestions?

I sometimes observe similar behaviour if I delete/refile task in file.
Then, if agenda view is not refreshed, tasks nearby might be messed up.
Presumably, it happens because markers saved in the agenda view (see
'org-hd-marker or 'org-marker text properties in agenda) are outdated
and point to wrong place.

So, you may need to check your config for any code affecting markers or
changing text in buffer. 

Best,
Ihor

James N. V. Cash  writes:

 It seems to always work properly from the org buffer itself, so I assume
 it's something happening in the agenda, but I'm not sure where to look.
 I've tried debugging `org-agenda-todo`, but I can't see anything in
 askance there. Any advice as to what I should be looking for?
>
> Trying to do more work to track this down and I'm perhaps more confused than 
> I was before.
>
> I can consistently make this happen by opening my todo.org file which
> contains two recurring tasks, call them A and B.
>
> I start by putting the cursor on task A, then running org-agenda and
> using that to complete task B. This then results in task A showing twice
> in the agenda list and refreshing the agenda/checking the file shows
> task A completed & rescheduled to the next day and task B marked DONE
> and not repeated.
>
> Trying to track this down, I see in `org-todo`, the point moves from
> where org-agenda-todo positioned it in task B to inside where I had the
> cursor originally in the todo.org buffer, in task A. Strangely, I see
> the point changing when the `next` variable is printed out via
> `message` (I can also see the point changing after logging out org-state).
>
> If I print out either of those variables with the "%S" format string
> instead of "%s", the point doesn't move.
>
> This doesn't happen with emacs -Q, so presumably there's something in my
> config that's making this happen, but I have no idea what I should be
> looking for. Any suggestions?
>
> James



Re: Bug: org-capture: %L causes arg out of range error for empty string annotation [9.4 (release_9.4-31-g8c44f2 @ /home/n/.emacs.d/straight/build/org/)]

2020-09-25 Thread Kyle Meyer
No Wayman writes:

> No Wayman  writes:
>
>> If `v-a' is an empty string, the call to `replace-match' throws 
>> an
>> Args out of range error. Similar assignments in that area of the
>> code use an `and' comparison to guard against this, so perhaps 
>> it
>> should be:
>>
>>
>>> (v-L (if (and v-a (string-match l-re v-a))
>>> (replace-match "\\1" nil nil v-a)
>>>   v-a))
>
> See attached patch

Thank you.  Applied (1d66a58a2).



preserving marks upon org-agenda-redo-all

2020-09-25 Thread Samuel Wales
seems redoing the agenda by doing g in tags agenda view unmarks all.
perhaps it should persist those?

we have mark persistence for bulk actions.

just an idea.

thanks.

-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Fwd: expiring logbook

2020-09-25 Thread Samuel Wales
just wondering out loud what is usually done here.  open ended.

in principle one could sort in agenda by logbook size and have it show
the 20 biggest.

one could have a command to show logbook [in case any relevant notes
worth saving]
then ask user whether to archive.  archiving would consist of the
header prepended by "=logbook=" or so.  body = logbook.

idk.  not sure i want to keep logbook in agenda files at least for
some entries.  much of this is for speed and size.  some of this is to
eliminate clutter of low-value inactive timestamps for later timestamp
agenda ["daily/weekly"] with log mode.



Re: Bug: Infinite loop caused by org-agenda-property-list [9.4 (9.4-elpa @ /home/dsmasterson/.emacs.d/elpa/org-9.4/)]

2020-09-25 Thread Nick Dokos
David Masterson  writes:

> Nick Dokos  writes:
>
>> From what I can gather, this does not have much to do with Org mode
>> proper, which has no org-agenda-property-list at all. I presume that
>> you have
>>
>> https://github.com/Malabarba/org-agenda-property/blob/master/org-agenda-property.el
>>
>> installed, which does provide such a variable, but all that one can
>> say atm is that that library has a bug *or* is incompatible with
>> (current?) Org mode.  In either case, I think you should report it as
>> an issue to the above site.  Once they have figured out what is wrong,
>> then maybe an RFE against Org mode *might* be indicated.
>
> Ah!  That makes sense.  I'll look into it.
>

You might be able to work around the problem by having org-agenda-property put 
the
property on the same line:

   (setq org-agenda-property-position 'same-line)

and adjusting the position on the line with

   (setq org-agenda-property-column 100)

if necessary.

If the infinite loop goes away in that case, then you have some confirmation of 
your
theory about two-line agenda entries.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: Occasional error with recurring tasks in agenda [9.4 (release_9.4-3-ge6021b @ /home/james/.config/emacs/straight/build/org-plus-contrib/)]

2020-09-25 Thread James N . V . Cash


>>> It seems to always work properly from the org buffer itself, so I assume
>>> it's something happening in the agenda, but I'm not sure where to look.
>>> I've tried debugging `org-agenda-todo`, but I can't see anything in
>>> askance there. Any advice as to what I should be looking for?

Trying to do more work to track this down and I'm perhaps more confused than I 
was before.

I can consistently make this happen by opening my todo.org file which
contains two recurring tasks, call them A and B.

I start by putting the cursor on task A, then running org-agenda and
using that to complete task B. This then results in task A showing twice
in the agenda list and refreshing the agenda/checking the file shows
task A completed & rescheduled to the next day and task B marked DONE
and not repeated.

Trying to track this down, I see in `org-todo`, the point moves from
where org-agenda-todo positioned it in task B to inside where I had the
cursor originally in the todo.org buffer, in task A. Strangely, I see
the point changing when the `next` variable is printed out via
`message` (I can also see the point changing after logging out org-state).

If I print out either of those variables with the "%S" format string
instead of "%s", the point doesn't move.

This doesn't happen with emacs -Q, so presumably there's something in my
config that's making this happen, but I have no idea what I should be
looking for. Any suggestions?

James



Re: [PATCH] org-plot abstractions and extension

2020-09-25 Thread TEC


Hello everyone. Just in case this has slipped through the cracks /
fallen under the radar --- here's a little bump.

Timothy.

TEC  writes:

> Oooops, I've just noticed my patch attachment re-send was only addressed
> to Bastien (maybe this is why I haven't heard anything?).
> This is what I get for mixing mail clients and not paying attention
> I guess .
>
> If someone would be willing to have a look through my work, and comment
> - that would be fantastic.
>
> I'd love to get my code into shape to be merged :)
>
> All the best,
>
> Timothy.



Re: [PATCH] Enhance org-html--build-meta-info

2020-09-25 Thread TEC


@Maintainers I think this is ready for a review.

Jens Lechtenboerger  writes:

> My suggestion would be to go with the handling of description in all
> cases, including the title.

Currently the only element handled differently to
`org-html-encode-plain-text' is "author". I don't know why so I don't
want to touch it.

> I added keywords to my OER presentations because some crawlers use
> them to extract topics for classification of documents.  I’d like to
> keep that.

Re-added.

Let me know if there's anything else,

Timothy.

-
Updated patch below:


>From da3878493a8c7097bf44add925696ede86ede661 Mon Sep 17 00:00:00 2001
From: TEC 
Subject: [PATCH] lisp/ox-html.el: make html meta func nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The opportunity was taken to extract most metadata info to custom
variable `org-html-meta-tags', allowing for easy end-user modification.
---
 lisp/ox-html.el | 115 +++-
 1 file changed, 65 insertions(+), 50 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..6efb76e12 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,28 @@ not be modified."
 
  Template :: Styles
 
+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+  (when (org-string-nw-p author)
+   (list "name" "author" author)))
+(lambda (_title _author info)
+  (when (org-string-nw-p (plist-get info :description))
+   (list "name" "description"
+   (plist-get info :description
+("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to `org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a function which
+generates such a list with signature (TITLE AUTHOR INFO) where TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+ (choice
+  (list (string :tag "Meta label")
+(string :tag "label value")
+(string :tag "Content value"))
+  function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,23 +1857,32 @@ INFO is a plist used as a communication channel."

 ;;; Template
 
+(defun org-html--build-meta-entry (label identity  content-format 
 content-formatters)
+  "Construct  tag with LABEL=\"IDENTITY\" and content from 
CONTENT-FORMAT and CONTENT-FORMATTER."
+  (concat "\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-  (lambda (str)
-(replace-regexp-in-string
- "\"" "" (org-html-encode-plain-text str
- (title (org-export-data (plist-get info :title) info))
+  (let* ((title (org-html-encode-plain-text (plist-get info :title) info))
  ;; Set title to an invisible character instead of leaving it
  ;; empty, which is invalid.
  (title (if (org-string-nw-p title) title ""))
  (author (and (plist-get info :with-author)
   (let ((auth (plist-get info :author)))
-   ;; Return raw Org syntax.
+ ;; Return raw Org syntax.
 (and auth (org-element-interpret-data auth)
- (description (plist-get info :description))
- (keywords (plist-get info :keywords))
+(keywords (plist-get info :keywords))
  (charset (or (and org-html-coding-system
(fboundp 'coding-system-get)
(coding-system-get org-html-coding-system
@@ -1863,50 +1894,34 @@ INFO is a plist used as a communication channel."
(concat "\n")))
- (format
-  (if (org-html-html5-p info)
- (org-html-close-tag "meta" "charset=\"%s\"" info)
-   (org-html-close-tag
-"meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-info))
-  charset) "\n"
+
+ (if (org-html-html5-p info)
+(org-html--build-meta-entry "charset" charset)
+   (org-html--build-meta-entry "http-equiv" "Content-Type"
+  (concat "text/html;charset=" charset)))
+
  (let ((viewport-options
-   (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
- (plist-get info :html-viewport
-   (and viewport-options
-   (concat
-(org-html-close-tag
- "meta"
- (format "name=\"viewport\" content=\"%s\""
- (mapconcat
-  (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-  viewport-options ", "))
- info)
-

Re: problem with org-capture (via gnus-icalendar-event-export)

2020-09-25 Thread Eric S Fraga
On Friday, 25 Sep 2020 at 12:31, Kyle Meyer wrote:
> I think No Wayman just sent a patch to fix this:
>
> I'll take a look at it tonight unless someone gets to it sooner.

Okay but no rush from my end.  Calendar stuff can wait until Monday for
me: it's now officially the weekend! ;-)

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-31-g8c44f2



Re: problem with org-capture (via gnus-icalendar-event-export)

2020-09-25 Thread Kyle Meyer
Eric S Fraga writes:

> Hello,
>
> I use gnus-icalendar-event-export to calendar invites to my org agenda
> files.  This uses org-capture and suddenly this appears to have stopped
> working.  See attached backtrace.
>
> I don't have time to debug at the moment but thought I'd bring this to
> the attention of the list just in case.  My org and gnus are both recent
> from git as of a few minutes ago.

I think No Wayman just sent a patch to fix this:
https://orgmode.org/list/87lfgyz48x@gmail.com

I'll take a look at it tonight unless someone gets to it sooner.



problem with org-capture (via gnus-icalendar-event-export)

2020-09-25 Thread Eric S Fraga
Hello,

I use gnus-icalendar-event-export to calendar invites to my org agenda
files.  This uses org-capture and suddenly this appears to have stopped
working.  See attached backtrace.

I don't have time to debug at the moment but thought I'd bring this to
the attention of the list just in case.  My org and gnus are both recent
from git as of a few minutes ago.

I do note that there has been some work on org-capture recently...

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-31-g8c44f2
Debugger entered--Lisp error: (error "Capture abort: Args out of range: 376753, 
376756")
  signal(error ("Capture abort: Args out of range: 376753, 376756"))
  error("Capture abort: %s" "Args out of range: 376753, 376756")
  org-capture()
  org-capture-string(#("* T1 Priorities ()\n:PROPERTIES:\n:ICAL_EVENT: 
t\n:ID..." 0 19 (wrap-prefix #("* " 0 2 (face org-indent)) line-prefix "") 19 
32 (wrap-prefix #("  " 0 2 (face org-indent)) line-prefix #("  " 0 2 (face 
org-indent))) 32 47 (wrap-prefix #("  " 0 2 (face org-indent)) line-prefix #("  
" 0 2 (face org-indent))) 47 173 (wrap-prefix #("  " 0 2 (face org-indent)) 
line-prefix #("  " 0 2 (face org-indent))) 173 205 (wrap-prefix #("  " 0 2 
(face org-indent)) line-prefix #("  " 0 2 (face org-indent))) 205 216 
(wrap-prefix #("  " 0 2 (face org-indent)) line-prefix #("  " 0 2 (face 
org-indent))) 216 246 (wrap-prefix #("  " 0 2 (face org-indent)) line-prefix 
#("  " 0 2 (face org-indent))) 246 277 (wrap-prefix #("  " 0 2 (face 
org-indent)) line-prefix #("  " 0 2 (face org-indent))) 277 296 (wrap-prefix 
#("  " 0 2 (face org-indent)) line-prefix #("  " 0 2 (face org-indent))) 296 
304 (wrap-prefix #("  " 0 2 (face org-indent)) line-prefix #("  " 0 2 (face 
org-indent))) 304 333 (wrap-prefix #("  " 0 2 (face org-indent)) line-prefix 
#("  " 0 2 (face org-indent))) 333 339 (wrap-prefix #("  " 0 2 (face 
org-indent)) line-prefix #("  " 0 2 (face org-indent))) 339 340 (wrap-prefix 
#("  " 0 2 (face org-indent)) line-prefix #("  " 0 2 (face org-indent))) 340 
367 (wrap-prefix #("" 0 4 (face org-indent)) line-prefix #("  " 0 2 (face 
org-indent))) 367 368 (wrap-prefix #("  " 0 2 (face org-indent)) line-prefix 
#("  " 0 2 (face org-indent))) 368 389 (wrap-prefix #("" 0 4 (face 
org-indent)) line-prefix #("  " 0 2 (face org-indent))) ...) "#")
  gnus-icalendar:org-event-save(# nil)
  #f(compiled-function (event reply-status) #)(# nil)
  apply(#f(compiled-function (event reply-status) #) # nil)
  gnus-icalendar-event:sync-to-org(# nil)
  gnus-icalendar-sync-event-to-org(#)
  gnus-icalendar-event-export()
  funcall-interactively(gnus-icalendar-event-export)
  call-interactively(gnus-icalendar-event-export nil nil)
  command-execute(gnus-icalendar-event-export)


Re: org-tables with monetary amounts

2020-09-25 Thread Alan Schmitt
Hello,

On 2020-09-25 13:20, Daniele Nicolodi  writes:

> I use beancoount (another text-based accounting software, very similar
> to ledger) for accounting purposes and I am very happy with it. I use
> org-mode for planning and management tasks or simply to compare quotes,
> things better handled in a a spreadsheet table.

I use ledger, and I wrote a small page about how I use org with it:
http://alan.petitepomme.net/tips/ledger_and_org.html

> I think it is time to have a look at how org-tables can be extended to
> handle monetary quantities.

Yes! I'm currently writing a tutorial about envelope budgeting (using
org-mode, of course), and it would help to have my table examples with
monetary quantities.

Best,

Alan


signature.asc
Description: PGP signature


Re: org-tables with monetary amounts

2020-09-25 Thread Daniele Nicolodi
On 25/09/2020 11:25, Neil Jerram wrote:
> Aside: Perhaps I'm misunderstanding them, but none of the open source
> tools, including (h)ledger, seem to be of much help here.
> - They focus on data entry and reconciliation, which I don't need as I'm
> happy to download and use OFX files from my bank.

I don't think the focus of ledger (or hledger, or beancount) is on data
entry. Actually beancount even has an ingest framework to deal with
importing data from bank statements and other sources.

> - They don't offer anything intelligent and automated for automatically
> categorizing transactions.

For beancount there is smart_importer
https://github.com/beancount/smart_importer and it is not difficult to
hack your own. I indeed use my own tool based on a simple machine
learning algorithm implemented by scikit-learn (Python).

> - They don't have a sophisticated representation of a budget, and
> reporting against that.

I am not sure what you mean by "sophisticated representation of a
budged". Once you categorize expenses in a (hierarchical) set of
expenses accounts it is trivial to use something like beancount to check
the balances against a budget.

> Do you know of a good forum (other than this!) for discussing such points?

The ledger-cli and the beancount mailing lists may be the right places
to discuss the use of these tools.

> I've attached mine, in case you read Scheme and there's more detail in
> there that is of interest.

My use case is very different, thus something external to org-mode is
not really useful.

Maybe an example would clarify what my use case is. I am working on a
research proposal where I need to provide details about funding
allocation in a few different categories over a certain amount of years.
In my document this is an org-table. Right now I have two choices to
edit the table:

- have monetary amounts in the cells (example "123.00 EUR") and do the
match externally,

- do the math in the org-table, specify the right formatting for all
computed cells, and still have to post-process it to add the currency
symbols to the input cells.

Either solution is sub-optimal. It would be nice if org-tables could
support monetary fields as they support time fields.

Cheers,
Dan



Re: org-tables with monetary amounts

2020-09-25 Thread Daniele Nicolodi
On 23/09/2020 18:55, Eric S Fraga wrote:
> Not answering your question directly but, depending on why and how you
> are using org tables for monetary calculations, you may wish to look at
> ledger [1].  There is support in org for ledger via babel (ob-ledger.el,
> distributed with org).

Hello Eric,

I use beancoount (another text-based accounting software, very similar
to ledger) for accounting purposes and I am very happy with it. I use
org-mode for planning and management tasks or simply to compare quotes,
things better handled in a a spreadsheet table.

I think it is time to have a look at how org-tables can be extended to
handle monetary quantities.

Cheers,
Dan



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Pierre-Henry F.
Well, this works!
Thank you all!

(defun user-custom-keywords ()
  ;; M-x list-faces-display
  (let ((user-custom-keywords
  '((":next:" . 'org-habit-clear-face)
 (":wait:" . 'org-habit-alert-face)
 (":failed:" . 'org-habit-overdue-face)
 (":success:" . 'org-habit-ready-face)
 (":unscheduled:" . 'avy-lead-face-0

(dolist (elt user-custom-keywords)
  (let ((regex (car elt))
 (face (cdr elt)))
(font-lock-add-keywords
  nil
  `((,regex 0 ,face t))
  'append)


Cordialement,
Pierre-Henry FRÖHRING
+33 6 34 48 17 57
cont...@phfrohring.com
Skype: pierre.henry.frohring

‐‐‐ Original Message ‐‐‐
On Friday, September 25, 2020 10:31 AM, Pierre-Henry F. 
 wrote:

> Thank you Ihor,
>
> It does work... too good now :-)
>
> all the other faces are gone
>
> Well, OK...
>
> I will check that an other time.
>
> Thank you all for your replies !
>
> PHF
>
> ‐‐‐ Original Message ‐‐‐
> On Friday, September 25, 2020 10:13 AM, Ihor Radchenko yanta...@gmail.com 
> wrote:
>
> > > As suggested by Ihor, I tried:
> >
> > > (font-lock-add-keywords 'org-mode
> > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
> >
> > You need to fontify itafter all other org-mode font settings:
> > (font-lock-add-keywords 'org-mode
> > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append))
> > Best,
> > Ihor
> > "Pierre-Henry F." cont...@phfrohring.com writes:
> >
> > > Thank you very much for your replies.
> > > Here is the use case:
> > > |---+|
> > > | something | :next: |
> > > |---+|
> > > I would like :next: to show up using an arbitrary face.
> > > As suggested by Ihor, I tried:
> > > (font-lock-add-keywords 'org-mode
> > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
> > > in my init.el
> > > It does not work either.
> > > @Christian yes, it's the same syntax as tags, I would like to extend it 
> > > eventually.
> > > Thanks,
> > > PHF
> > > ‐‐‐ Original Message ‐‐‐
> > > On Friday, September 25, 2020 9:26 AM, Ihor Radchenko yanta...@gmail.com 
> > > wrote:
> > >
> > > > > (add-to-list 'org-font-lock-extra-keywords
> > > >
> > > > It is internal variable. You should not use it.
> > > > Simply use font-lock-add-keywords instead.
> > > > Best,
> > > > Ihor
> > > > "Pierre-Henry F." cont...@phfrohring.com writes:
> > > >
> > > > > Hello,
> > > > > I would like to extend the org-mode markup.
> > > > > For example, I would like to change the face of a keyword, say: 
> > > > > :next: .
> > > > > Whenever :next: is displayed from an org-mode buffer, it should show 
> > > > > up in using an arbitrary face.
> > > > > I tried this:
> > > > > (defun org-add-my-extra-markup ()
> > > > > (add-to-list 'org-font-lock-extra-keywords
> > > > > '("[^\\w]\\(:next:\\)[^\\w]"
> > > > > (1 font-lock-warning-face t
> > > > > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
> > > > > But it does not work.
> > > > > So: how to extend org-mode markup?
> > > > > Many thanks,
> > > > > PHF





Re: org-tables with monetary amounts

2020-09-25 Thread Neil Jerram
On Tue, 22 Sep 2020 at 17:05, Daniele Nicolodi  wrote:

> Hello,
>

Hi Daniele...


>
> I often use org-tables to work with monetary amounts.


Me too.  I use Org mode plus Scheme code to try to analyze my bank
statements and compare them against a budget.  Org is a convenient form for
specifying the inputs - e.g. the names of OFX files to read, and string
matches for how I want to categorize the transactions - and for displaying
the results.

Aside: Perhaps I'm misunderstanding them, but none of the open source
tools, including (h)ledger, seem to be of much help here.
- They focus on data entry and reconciliation, which I don't need as I'm
happy to download and use OFX files from my bank.
- They don't offer anything intelligent and automated for automatically
categorizing transactions.
- They don't have a sophisticated representation of a budget, and reporting
against that.
Do you know of a good forum (other than this!) for discussing such points?


> It would be very
> nice to have a couple of functionalities common in this domain:
>
> - fixed precision arithmetic, namely derive the precision of the results
> from the precision of the arguments (I think that calc can do this),
>

In my Scheme code, I convert between strings and pence:

;; In this file, an amount at rest is always represented as a string
;; with 2 decimal places.  Convert from that to an integer number of
;; pence:

(define (amount->pence amount)
  (inexact->exact (round (* 100 (string->number amount)

;; And the reverse:

(define (pence->amount pence)
  (format-2dp (/ (exact->inexact pence) 100)))


>
> - support for parsing numbers followed by currencies,
>
> - correct alignment for monetary values.
>
> I had a quick look around, but I haven't found anything that implements
> those things. Has anyone some secret code that they would like to share?
>

I've attached mine, in case you read Scheme and there's more detail in
there that is of interest.

Best wishes,
Neil

(add-to-load-path (in-vicinity (getenv "HOME") "ossaulib"))

(use-modules (ice-9 format)
	 (ice-9 regex)
	 (ossau ofx)
	 (srfi srfi-1)
	 (sxml simple)
	 (sxml match)
	 (srfi srfi-19))

;; (ossau ofx) provides 'get-transactions' to read transactions from a
;; single OFX file.  Let's build on that to read transactions from
;; multiple OFX files, assuming that the files given are already
;; ordered by date, so that the transactions in them follow on from
;; each other.

(define (read-transactions . files)
  (apply append (map get-transactions files)))

;; Return a date that is 00:00 UTC on the day of the given transaction.

(define (tx-date tx)
  (let ((d (string->date (tx:date tx) "~Y~m~d")))
(make-date 0 0 0 0			; nsec sec min hr
	   (date-day d)
	   (date-month d)
	   (date-year d)
	   0			; zone offset, i.e. UTC
	   )))

;; Given a date, return a date that is the start of the next month.

(define (start-of-following-month d)
  (if (= (date-month d) 12)
  (make-date 0 0 0 0		; nsec sec min hr
		 1			; day of month
		 1			; month of year
		 (+ (date-year d) 1)
		 0			; zone offset, i.e. UTC
		 )
  (make-date 0 0 0 0		; nsec sec min hr
		 1			; day of month
		 (+ (date-month d) 1)
		 (date-year d)
		 0			; zone offset, i.e. UTC
		 )))

;; Given a date, return a date that is exactly N days later.

(define (n-days-later d n)
  (julian-day->date (+ (date->julian-day d) n)))

;; Compare two dates.

(define (date-before? d1 d2)
  (< (date->julian-day d1) (date->julian-day d2)))

;; Given a series of transactions, partition them into an alist of
;; smaller series according to time periods calculated from START-DATE
;; and NEXT-START-DATE-PROC: the start of the first period is
;; START-DATE, the start of the second period is (NEXT-START-DATE-PROC
;; START-DATE), the start of the third period is (NEXT-START-DATE-PROC
;; (NEXT-START-DATE-PROC START-DATE)), and so on.  In the returned
;; alist, each entry is (DATE . TX-LIST), where DATE is the exclusive
;; period end date (== the start date of the following period) for the
;; transactions in TX-LIST.

(define (partition-by-period txs start-date next-start-date-proc)
  (let loop ((txs txs)
	 (partition-end-date-exclusive (next-start-date-proc start-date))
	 (previous-partitions '())
	 (current-partition '()))
(if (null? txs)
	(reverse (acons partition-end-date-exclusive current-partition previous-partitions))
	(let* ((tx (car txs)))
	  (if (date-before? (tx-date tx) partition-end-date-exclusive)
	  ;; This transaction is within the current partition.
	  (loop (cdr txs)
		partition-end-date-exclusive
		previous-partitions
		(cons tx current-partition))
	  ;; This transaction is after the current partition.  But
	  ;; bear in mind that it might not be in the immediate
	  ;; next partition either.  The safest thing to do is to
	  ;; close out the current partition, advance the limit
	  ;; 

Re: org-table-sum

2020-09-25 Thread Robert Pluim
> On Thu, 24 Sep 2020 16:48:14 -0400, Kyle Meyer  said:

>> I did not find a way to reproduce this with other numbers, but the
>> order seems to matter.

Kyle> See .

Exactly. Which is why you should use 'calc' with floating point
numbers, it handles them correctly. i.e.

| 171.00 |
|   4.07 |
|   4.44 |
|   2.61 |
|  12.21 |
|   6.69 |
|  19.72 |
|  23.09 |
|   6.23 |
|  15.28 |
| 250.00 |
| 250.00 |
| 250.00 |
|  78.85 |
||
||
#+TBLFM:@>$1=vsum(@1$1..@-1$1)

Put point in that empty cell and do 'C-u C-c C-c'

Robert



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Pierre-Henry F.
Thank you Ihor,

It does work... too good now :-)

all the other faces are gone

Well, OK...

I will check that an other time.

Thank you all for your replies !

PHF

‐‐‐ Original Message ‐‐‐
On Friday, September 25, 2020 10:13 AM, Ihor Radchenko  
wrote:

> > As suggested by Ihor, I tried:
>
> > (font-lock-add-keywords 'org-mode
> > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
>
> You need to fontify itafter all other org-mode font settings:
>
> (font-lock-add-keywords 'org-mode
> '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append))
>
> Best,
> Ihor
>
> "Pierre-Henry F." cont...@phfrohring.com writes:
>
> > Thank you very much for your replies.
> > Here is the use case:
> > |---+|
> > | something | :next: |
> > |---+|
> > I would like :next: to show up using an arbitrary face.
> > As suggested by Ihor, I tried:
> > (font-lock-add-keywords 'org-mode
> > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
> > in my init.el
> > It does not work either.
> > @Christian yes, it's the same syntax as tags, I would like to extend it 
> > eventually.
> > Thanks,
> > PHF
> > ‐‐‐ Original Message ‐‐‐
> > On Friday, September 25, 2020 9:26 AM, Ihor Radchenko yanta...@gmail.com 
> > wrote:
> >
> > > > (add-to-list 'org-font-lock-extra-keywords
> > >
> > > It is internal variable. You should not use it.
> > > Simply use font-lock-add-keywords instead.
> > > Best,
> > > Ihor
> > > "Pierre-Henry F." cont...@phfrohring.com writes:
> > >
> > > > Hello,
> > > > I would like to extend the org-mode markup.
> > > > For example, I would like to change the face of a keyword, say: :next: .
> > > > Whenever :next: is displayed from an org-mode buffer, it should show up 
> > > > in using an arbitrary face.
> > > > I tried this:
> > > > (defun org-add-my-extra-markup ()
> > > > (add-to-list 'org-font-lock-extra-keywords
> > > > '("[^\\w]\\(:next:\\)[^\\w]"
> > > > (1 font-lock-warning-face t
> > > > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
> > > > But it does not work.
> > > > So: how to extend org-mode markup?
> > > > Many thanks,
> > > > PHF





Re: Help: how to extend org-mode markup?

2020-09-25 Thread Ihor Radchenko


Sorry, misplaced the argument. 'append should be the last argument to
font-lock-add-keywords:

(font-lock-add-keywords 'org-mode
  '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)) 'append)


Ihor Radchenko  writes:

>> As suggested by Ihor, I tried:
>>
>> (font-lock-add-keywords 'org-mode
>>   '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
>
> You need to fontify it _after_ all other org-mode font settings:
>
> (font-lock-add-keywords 'org-mode
>   '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append))
>
> Best,
> Ihor
>
>
> "Pierre-Henry F."  writes:
>
>> Thank you very much for your replies.
>>
>> Here is the use case:
>>
>> |---+|
>> | something | :next: |
>> |---+|
>>
>> I would like :next: to show up using an arbitrary face.
>>
>>
>> As suggested by Ihor, I tried:
>>
>> (font-lock-add-keywords 'org-mode
>>   '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
>>
>> in my init.el
>>
>> It does not work either.
>>
>>
>> @Christian yes, it's the same syntax as tags, I would like to extend it 
>> eventually.
>>
>>
>> Thanks,
>> PHF
>>
>> ‐‐‐ Original Message ‐‐‐
>> On Friday, September 25, 2020 9:26 AM, Ihor Radchenko  
>> wrote:
>>
>>> > (add-to-list 'org-font-lock-extra-keywords
>>>
>>> It is internal variable. You should not use it.
>>>
>>> Simply use font-lock-add-keywords instead.
>>>
>>> Best,
>>> Ihor
>>>
>>> "Pierre-Henry F." cont...@phfrohring.com writes:
>>>
>>> > Hello,
>>> > I would like to extend the org-mode markup.
>>> > For example, I would like to change the face of a keyword, say: :next: .
>>> > Whenever :next: is displayed from an org-mode buffer, it should show up 
>>> > in using an arbitrary face.
>>> > I tried this:
>>> > (defun org-add-my-extra-markup ()
>>> > (add-to-list 'org-font-lock-extra-keywords
>>> > '("[^\\w]\\(:next:\\)[^\\w]"
>>> > (1 font-lock-warning-face t
>>> > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
>>> > But it does not work.
>>> > So: how to extend org-mode markup?
>>> > Many thanks,
>>> > PHF



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Ihor Radchenko
> As suggested by Ihor, I tried:
>
> (font-lock-add-keywords 'org-mode
>   '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))

You need to fontify it _after_ all other org-mode font settings:

(font-lock-add-keywords 'org-mode
  '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append))

Best,
Ihor


"Pierre-Henry F."  writes:

> Thank you very much for your replies.
>
> Here is the use case:
>
> |---+|
> | something | :next: |
> |---+|
>
> I would like :next: to show up using an arbitrary face.
>
>
> As suggested by Ihor, I tried:
>
> (font-lock-add-keywords 'org-mode
>   '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
>
> in my init.el
>
> It does not work either.
>
>
> @Christian yes, it's the same syntax as tags, I would like to extend it 
> eventually.
>
>
> Thanks,
> PHF
>
> ‐‐‐ Original Message ‐‐‐
> On Friday, September 25, 2020 9:26 AM, Ihor Radchenko  
> wrote:
>
>> > (add-to-list 'org-font-lock-extra-keywords
>>
>> It is internal variable. You should not use it.
>>
>> Simply use font-lock-add-keywords instead.
>>
>> Best,
>> Ihor
>>
>> "Pierre-Henry F." cont...@phfrohring.com writes:
>>
>> > Hello,
>> > I would like to extend the org-mode markup.
>> > For example, I would like to change the face of a keyword, say: :next: .
>> > Whenever :next: is displayed from an org-mode buffer, it should show up in 
>> > using an arbitrary face.
>> > I tried this:
>> > (defun org-add-my-extra-markup ()
>> > (add-to-list 'org-font-lock-extra-keywords
>> > '("[^\\w]\\(:next:\\)[^\\w]"
>> > (1 font-lock-warning-face t
>> > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
>> > But it does not work.
>> > So: how to extend org-mode markup?
>> > Many thanks,
>> > PHF



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Christian Moe


Please disregard my response. I misunderstood both your intention and
the use of font-lock keywords. Sorry for the noise. :-(

Yours,
Christian

Pierre-Henry F. writes:

> Thank you very much for your replies.
>
> Here is the use case:
>
> |---+|
> | something | :next: |
> |---+|
>
> I would like :next: to show up using an arbitrary face.
>
>
> As suggested by Ihor, I tried:
>
> (font-lock-add-keywords 'org-mode
>   '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
>
> in my init.el
>
> It does not work either.
>
>
> @Christian yes, it's the same syntax as tags, I would like to extend it 
> eventually.
>
>
> Thanks,
> PHF
>
> ‐‐‐ Original Message ‐‐‐
> On Friday, September 25, 2020 9:26 AM, Ihor Radchenko  
> wrote:
>
>> > (add-to-list 'org-font-lock-extra-keywords
>>
>> It is internal variable. You should not use it.
>>
>> Simply use font-lock-add-keywords instead.
>>
>> Best,
>> Ihor
>>
>> "Pierre-Henry F." cont...@phfrohring.com writes:
>>
>> > Hello,
>> > I would like to extend the org-mode markup.
>> > For example, I would like to change the face of a keyword, say: :next: .
>> > Whenever :next: is displayed from an org-mode buffer, it should show up in 
>> > using an arbitrary face.
>> > I tried this:
>> > (defun org-add-my-extra-markup ()
>> > (add-to-list 'org-font-lock-extra-keywords
>> > '("[^\\w]\\(:next:\\)[^\\w]"
>> > (1 font-lock-warning-face t
>> > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
>> > But it does not work.
>> > So: how to extend org-mode markup?
>> > Many thanks,
>> > PHF



Re: org-table-sum

2020-09-25 Thread Eric S Fraga
On Thursday, 24 Sep 2020 at 21:38, Kein Test wrote:
> I found out about org-table-sum yesterday, but I quickly ran into a
> problem, where the result is not right.

It is right and due to the use of floating point arithmetic in the
computer.  If you ask org/calc to display the number with 2 decimal
places (;f2), you will have the result you expect.


-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-29-gbc9664



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Eric S Fraga
One alternative, that I use for specific org files, is
~hi-lock-mode~.  Based on regular expressions, you can highlight any
bits you want without affecting the underlying org font lock settings.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-29-gbc9664



Re: Bug: org-capture: %L causes arg out of range error for empty string annotation [9.4 (release_9.4-31-g8c44f2 @ /home/n/.emacs.d/straight/build/org/)]

2020-09-25 Thread No Wayman


No Wayman  writes:

If `v-a' is an empty string, the call to `replace-match' throws 
an

Args out of range error. Similar assignments in that area of the
code use an `and' comparison to guard against this, so perhaps 
it

should be:



(v-L (if (and v-a (string-match l-re v-a))
(replace-match "\\1" nil nil v-a)
  v-a))


See attached patch

>From be476c236e40dd0ba87be9d466dd5cd00a6960b7 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer 
Date: Fri, 25 Sep 2020 03:42:57 -0400
Subject: [PATCH] capture: Fix bare link "Args out of range"

* lisp/org-capture.el (org-capture-fill-template): guard against empty
annotation string
---
 lisp/org-capture.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index a6e95f24e..67c58ffdd 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1595,7 +1595,7 @@ The template may still contain \"%?\" for cursor positioning."
 	 (v-l (if (and v-a (string-match l-re v-a))
 		  (replace-match "[[\\1]]" nil nil v-a)
 		v-a))
-	 (v-L (if (or v-a (string-match l-re v-a))
+	 (v-L (if (and v-a (string-match l-re v-a))
 		  (replace-match "\\1" nil nil v-a)
 		v-a))
 	 (v-n user-full-name)
-- 
2.28.0



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Pierre-Henry F.
Thank you very much for your replies.

Here is the use case:

|---+|
| something | :next: |
|---+|

I would like :next: to show up using an arbitrary face.


As suggested by Ihor, I tried:

(font-lock-add-keywords 'org-mode
  '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))

in my init.el

It does not work either.


@Christian yes, it's the same syntax as tags, I would like to extend it 
eventually.


Thanks,
PHF

‐‐‐ Original Message ‐‐‐
On Friday, September 25, 2020 9:26 AM, Ihor Radchenko  
wrote:

> > (add-to-list 'org-font-lock-extra-keywords
>
> It is internal variable. You should not use it.
>
> Simply use font-lock-add-keywords instead.
>
> Best,
> Ihor
>
> "Pierre-Henry F." cont...@phfrohring.com writes:
>
> > Hello,
> > I would like to extend the org-mode markup.
> > For example, I would like to change the face of a keyword, say: :next: .
> > Whenever :next: is displayed from an org-mode buffer, it should show up in 
> > using an arbitrary face.
> > I tried this:
> > (defun org-add-my-extra-markup ()
> > (add-to-list 'org-font-lock-extra-keywords
> > '("[^\\w]\\(:next:\\)[^\\w]"
> > (1 font-lock-warning-face t
> > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
> > But it does not work.
> > So: how to extend org-mode markup?
> > Many thanks,
> > PHF





Bug: org-capture: %L causes arg out of range error for empty string annotation [9.4 (release_9.4-31-g8c44f2 @ /home/n/.emacs.d/straight/build/org/)]

2020-09-25 Thread No Wayman



d06aa486d6c3163b6ef6e9ab665117bd93dff34a introduces the following 
in

`org-capture-fill-template':


(v-L (if (or v-a (string-match l-re v-a))
(replace-match "\\1" nil nil v-a)
  v-a))


If `v-a' is an empty string, the call to `replace-match' throws an 
Args out of range error. Similar assignments in that are of the 
code use an `and' comparison to guard against this, so perhaps it 
should be:




(v-L (if (and v-a (string-match l-re v-a))
(replace-match "\\1" nil nil v-a)
  v-a))



Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ 
Version 3.24.23, cairo version 1.17.3)

of 2020-09-19
Package: Org mode version 9.4 (release_9.4-31-g8c44f2 @ 
/home/n/.emacs.d/straight/build/org/)




Re: Help: how to extend org-mode markup?

2020-09-25 Thread Ihor Radchenko
> (add-to-list 'org-font-lock-extra-keywords

It is internal variable. You should not use it.

Simply use font-lock-add-keywords instead.

Best,
Ihor

"Pierre-Henry F."  writes:

> Hello,
>
> I would like to extend the org-mode markup.
>
> For example, I would like to change the face of a keyword, say: :next: .
>
> Whenever :next: is displayed from an org-mode buffer, it should show up in 
> using an arbitrary face.
>
> I tried this:
>
> (defun org-add-my-extra-markup ()
> (add-to-list 'org-font-lock-extra-keywords
> '("[^\\w]\\(:next:\\)[^\\w]"
> (1 font-lock-warning-face t
>
> (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
>
> But it does not work.
>
> So: how to extend org-mode markup?
>
> Many thanks,
> PHF



Re: Help: how to extend org-mode markup?

2020-09-25 Thread Christian Moe


Hello,

In your example, `:next:' is a tag. Tags and keywords are different
entities.
https://orgmode.org/worg/dev/org-syntax.html

You should be able to do what you want by customizing `org-tag-faces'.

Yours,
Christian 

Pierre-Henry F. writes:

> Hello,
>
> I would like to extend the org-mode markup.
>
> For example, I would like to change the face of a keyword, say: :next: .
>
> Whenever :next: is displayed from an org-mode buffer, it should show up in 
> using an arbitrary face.
>
> I tried this:
>
> (defun org-add-my-extra-markup ()
> (add-to-list 'org-font-lock-extra-keywords
> '("[^\\w]\\(:next:\\)[^\\w]"
> (1 font-lock-warning-face t
>
> (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
>
> But it does not work.
>
> So: how to extend org-mode markup?
>
> Many thanks,
> PHF



Help: how to extend org-mode markup?

2020-09-25 Thread Pierre-Henry F.
Hello,

I would like to extend the org-mode markup.

For example, I would like to change the face of a keyword, say: :next: .

Whenever :next: is displayed from an org-mode buffer, it should show up in 
using an arbitrary face.

I tried this:

(defun org-add-my-extra-markup ()
(add-to-list 'org-font-lock-extra-keywords
'("[^\\w]\\(:next:\\)[^\\w]"
(1 font-lock-warning-face t

(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)

But it does not work.

So: how to extend org-mode markup?

Many thanks,
PHF

Re: Bug: Infinite loop caused by org-agenda-property-list [9.4 (9.4-elpa @ /home/dsmasterson/.emacs.d/elpa/org-9.4/)]

2020-09-25 Thread David Masterson
Nick Dokos  writes:

> From what I can gather, this does not have much to do with Org mode
> proper, which has no org-agenda-property-list at all. I presume that
> you have
>
> https://github.com/Malabarba/org-agenda-property/blob/master/org-agenda-property.el
>
> installed, which does provide such a variable, but all that one can
> say atm is that that library has a bug *or* is incompatible with
> (current?) Org mode.  In either case, I think you should report it as
> an issue to the above site.  Once they have figured out what is wrong,
> then maybe an RFE against Org mode *might* be indicated.

Ah!  That makes sense.  I'll look into it.

Thanks

-- 
David Masterson