Turn function into interactive

2019-12-29 Thread Lawrence Bottorff
I've discovered org-outline-level which when in a code block under a given
header delivers as expected:

* This old level
#+BEGIN_SRC emacs-lisp
(org-current-level)
#+END_SRC

#+RESULTS:
: 1

Now, how could I turn this into an interactive callable with M-x? My stab
in the dark

(defun my-insert-level ()
  (interactive)
  (insert (org-outline-level)))

doesn't seem to be working. Or is there already an interactive that will
give me what level I'm at? My goal is to put this into a tempo template for
a PROPERTIES key-value, and I assume this sort of construct

(tempo-define-template "org-PROPERTIES_time-uuid-level"
'(":PROPERTIES:" n
":HLEVEL: " (my-insert-level) n
":Time: " (my-insert-dateutc) n
":UUID: " (my-insert-uuid) n
":END:" )
  "

Re: Long links

2019-12-29 Thread Steven Penny
On Sun, Dec 29, 2019 at 8:08 PM Nicolas Goaziou wrote:
> You can use angular links, e.g.,
>
>  Global_Objects/String/lastIndexOf++[lastIndexOf]>
>
> You can also use link abbreviations. Please refer to the manual for that
> one.

Hm, neither one of those methods seem to work with either of these parsers:

- https://github.com/niklasfasching/go-org
- https://github.com/wallyqs/org-ruby



Re: Long links

2019-12-29 Thread Nicolas Goaziou
Hello,

Steven Penny  writes:

> Sometimes I will have to deal with a long link, like this:
>
> https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf
>
> I prefer to wrap long links if possible. This is allowed with 
> reStructuredText:
>
> lastIndexOf_
>
> .. _lastIndexOf: https://developer.mozilla.org/docs/Web/JavaScript/
>Reference/Global_Objects/String/lastIndexOf
>
> and also with AsciiDoc via link syntax:
>
> link:++https://developer.mozilla.org/docs/Web/JavaScript/Reference/
> Global_Objects/String/lastIndexOf++[lastIndexOf]
>
> or variable syntax:
>
> :js: https://developer.mozilla.org/docs/Web/JavaScript/Reference
>
> {js}/Global_Objects/String/lastIndexOf
>
> Does Org Mode have some way to deal with this?

You can use angular links, e.g.,



You can also use link abbreviations. Please refer to the manual for that
one.

Regards,

-- 
Nicolas Goaziou



Long links

2019-12-29 Thread Steven Penny
Sometimes I will have to deal with a long link, like this:

https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf

I prefer to wrap long links if possible. This is allowed with reStructuredText:

lastIndexOf_

.. _lastIndexOf: https://developer.mozilla.org/docs/Web/JavaScript/
   Reference/Global_Objects/String/lastIndexOf

and also with AsciiDoc via link syntax:

link:++https://developer.mozilla.org/docs/Web/JavaScript/Reference/
Global_Objects/String/lastIndexOf++[lastIndexOf]

or variable syntax:

:js: https://developer.mozilla.org/docs/Web/JavaScript/Reference

{js}/Global_Objects/String/lastIndexOf

Does Org Mode have some way to deal with this?




org-deadline-warning-days per file

2019-12-29 Thread Colin Baxter


I have my org-deadline-warning-days set to 60 via

#+begin_src elisp
(setq org-deadline-warning-days 60)
#+end_src

in my ~/.emacs. How can I set it individually for each deadline in an
org-mode file?

Thanks.

-- 
Colin Baxter
www.Colin-Baxter.com




bug#38599: 27.0.50; org-agenda lists invalid Diary entries

2019-12-29 Thread Justin Abrahms
Thank you so much!

On Sat, Dec 28, 2019, at 12:22 PM, Thomas Fitzsimmons wrote:
> Hi,
> 
> Thomas Fitzsimmons  writes:
> 
> [...]
> 
> > Justin confirmed the attached patch fixes the problem for him. Can an
> > Org mode maintainer review it?
> 
> I also reported this upstream to the Org maintainers and they accepted
> the fix. Org 9.3.1, which contains the fix, has been released. You can
> install it from GNU ELPA. I'm marking this bug as done.
> 
> Thomas
> 

Org-publish: how do I access user-defined keywords in html-preamble function?

2019-12-29 Thread Giovanni Moretti
I'm working on a blog published via org-publish but one things got me stumped:
accessing user defined keywords while publishing to HTML:

Each post is in an orgmode file, and has a simple structure. E.g. one post 
starts with:

#+title: Fix for Sparkfun Arduino Pro Micro
#+date: <2009-03-05 13:55>
#+filetags: Arduino
#+category: electronics
#+draft: true

I want to access the last two keywords values when publishing but despite lots 
of
searching, can't find out how:

Part of my publish-project-alist:

(setq org-publish-project-alist
  `(
 ("blog-posts"
 :base-directory   "~/projects/3-blog/"
 :base-extension   "org"
 :recursive    t
   --- lots omitted
 :html-preamble  *my-blog-page-preamble*
 )

and /my-blog-page-preamble/ function is:

(defun *my-blog-page-preamble* (arg)
  (with-temp-buffer
    (insert-file-contents my-blog-page-preamble-file)   ; Insert preamble 
from file
    (concat (buffer-string)
   (format "Tags: %s"  (car (plist-get arg :filetags)))  *;* 
*<< WORKS*
   (format "Category: %s " (car (plist-get arg :category))) *;<< 
returns nil*
   (format "Draft: %s" (car (plist-get arg :draft))*;<< 
returns nil*

I can access/the values of :title/ or /:filetags/ and other predefined keywords 
but
not ones I define myself.

My keywords are being passed to the preamble-function as displaying 'arg' shows:

--LOTS OMITTED--#2 (keyword (:key DATE :value <2009-03-05 13:55> :begin 81 
:end
108 :post-blank 0 :post-affiliated 81 :parent #4)) (keyword (:key CATEGORY 
:value
electronics :begin 108 :end 132 :post-blank 0 :post-affiliated 108 :parent 
#4))
(keyword (:key FILETAGS :value Arduino :begin 132 :end 152 :post-blank 0
:post-affiliated 132 :parent #4)) (keyword (:key DRAFT :value true :begin 
152
:end 166 :post-blank 0 :post-affiliated 152 :parent #4)) -- LOTS MORE

I tried capitalizing -- (plist-get arg :CATEGORY) -- but that returns /nil/ too.

Given that /(plist-get arg :category)/ and /(plist-get arg :draft)/ don't 
return the
expected values, what's the correct way to access the values of /#+category:/ 
and
user-defined keywords such as /#+draft:/ keywords?

Many thanks
Giovanni*
*