DST and appointments in other timezones

2019-11-13 Thread Leo Gaspard
Hello world,

I have appointments that are scheduled on timezones other than my
computer's. Does org-mode support setting that? It looks like timestamps
don't support adding a timezone, so I'm wondering whether there's a
reasonable way to use s-expressions in timestamps for this?

Well, ideally org-mode could be adapted to support timestamps in
arbitrary timezones, but I guess there are reasons why that's not
supported?

Cheers, and huge thanks to all the devs and people who answer questions
like these!
  Leo



Org BABEL plantuml bug--mindmap mode

2019-11-13 Thread Spenser Truex
PlantUML has an "org-compatible" outlining mode to generate graphical tree
images. It is ironically not org /babel/ compatible, since org does not like
having lines starting with =*= in a source code block.

* Reproduction:

** Install instructions
1. Add config to your init.
#+begin_src emacs-lisp
(require 'plantuml-mode) ;Must install first.
(plantuml-set-exec-mode "server")
#+end_src


** Observe the bug
Put your cursor in this block and run =org-babel-execute maybe=. It will
not execute.


#+begin_src plantuml :file "~/aphids-are-plant-bugs.png"
@startmindmap
* This is weird
** It does not work
*** If you have bullet fonts on, they go all wonky.
*** Org thinks this stuff inside is not plantuml.
*** Cannot even do a src edit command.
@endmindmap
#+end_src


--
Spenser Truex
https://spensertruex.com/
San Francisco, USA



Org BABEL plantuml bug--mindmap mode

2019-11-13 Thread Spenser Truex
PlantUML has an "org-compatible" outlining mode to generate graphical tree
images. It is ironically not org /babel/ compatible, since org does not like
having lines starting with =*= in a source code block.

* Reproduction:

** Install instructions
1. Add config to your init.
#+begin_src emacs-lisp
(require 'plantuml-mode) ;Must install first.
(plantuml-set-exec-mode "server")
#+end_src


** Observe the bug
Put your cursor in this block and run =org-babel-execute maybe=. It will
not execute.


#+begin_src plantuml :file "~/aphids-are-plant-bugs.png"
@startmindmap
* This is weird
** It does not work
*** If you have bullet fonts on, they go all wonky.
*** Org thinks this stuff inside is not plantuml.
*** Cannot even do a src edit command.
@endmindmap
#+end_src


--
Spenser Truex
https://spensertruex.com/
San Francisco, USA



Bug: menu item: Add Source Example [9.2.6 (9.2.6-dist @ /path/to/org/install/emacs/site-lisp/org/)]

2019-11-13 Thread John Ciolfi


Hi

I just started using 9.2.6 and like the change for 
org-insert-structure-template to use key C-c C-, instead of the various 

Re: Set heading text from elisp?

2019-11-13 Thread Tim Visher
Nice! That looks like exactly what I wanted. Not sure how I missed that in
my apropos search. I think I may have only searched for `headline` or
something.

On Wed, Nov 13, 2019 at 7:08 AM Mikhail Skorzhinskii 
wrote:

> I am not sure if this is exactly what you're asking, but for programatic
> heading edits I am using this snippet:
>
> (let ((headline-only-text (org-get-heading t t t t)))
>   (org-edit-headline (concat "Web-page: " headline-only-text)))
>
> Probably the better way is to use org element API, but for small, rarely
> executed personal helpers I think this is OK.
>
> *I'm Wondering If There's Builtin Support For Editing Components Of The
> Heading? I'm Trying To Set The Text Component (I.E. `(Nth 4
> (Org-Heading-Components))`) Without Altering Anything Else And While I Can
> Obviously Achieve This With Generic Elisp I Wanted To Be Sure I Had To.*I'm
> wondering if there's builtin support for editing components of the heading?
> I'm trying to set the text component (i.e. `(nth 4
> (org-heading-components))`) without altering anything else and while I can
> obviously achieve this with generic elisp I wanted to be sure I had to.
>
> The cleanest elisp I came up with was:
>
> ```
> (save-excursion
>   (org-back-to-heading t)
>   (let (case-fold-search)
> (looking-at org-complex-heading-regexp)
> (replace-match text t t nil 4)
> (org-align-tags)))
>
> ```
>
> --
>
> In Christ,
>
> Timmy V.
>
> https://blog.twonegatives.com
> https://five.sentenc.es
>
>


Re: Set heading text from elisp?

2019-11-13 Thread Mikhail Skorzhinskii


I am not sure if this is exactly what you're asking, but for programatic heading edits I am using this snippet:



(let ((headline-only-text (org-get-heading t t t t)))
  (org-edit-headline (concat "Web-page: " headline-only-text)))



Probably the better way is to use org element API, but for small, rarely executed personal helpers I think this is OK.

I'm Wondering If There's Builtin Support For Editing Components Of The Heading? I'm Trying To Set The Text Component (I.E. `(Nth 4 (Org-Heading-Components))`) Without Altering Anything Else And While I Can Obviously Achieve This With Generic Elisp I Wanted To Be Sure I Had To.I'm wondering if there's builtin support for editing components of the heading? I'm trying to set the text component (i.e. `(nth 4 (org-heading-components))`) without altering anything else and while I can obviously achieve this with generic elisp I wanted to be sure I had to.The cleanest elisp I came up with was:```(save-excursion  (org-back-to-heading t)  (let (case-fold-search)    (looking-at org-complex-heading-regexp)    (replace-match text t t nil 4)    (org-align-tags)))```--In Christ,Timmy V.https://blog.twonegatives.comhttps://five.sentenc.es

Re: Exporting agendas as org-mode files?

2019-11-13 Thread Mikhail Skorzhinskii
Adam Porter  writes:

 > org-ql would make this pretty easy, I think.  Use an org-ql query to
 > select entries, and for the :action function, use a simple function that
 > copies the entry or subtree and yanks it into a buffer.  Then save that
 > buffer to a file.

Yes, it is.

Although just picking some entries from huge org-mode base and write
them into separate file is a base feature of org-mode itself. org-ql
package just making the process of finding entries of interest much
easier and faster.

John Sturdy  writes:

  > I'd like to be able to export agendas as org-mode files

If you're looking into the pure org-mode approach, then what you're
looking for ~org-agenda-write~ function or custom agenda view written
with exporting in mind. In order to export to org all you need to do is
to specify .org extension.

  https://orgmode.org/manual/Exporting-agenda-views.html

I was using this small snippet to export some of my agenda seacrhes:

#+begin_src emacs-lisp
  (org-agenda nil "a")
  (org-agenda-write "~/example.org" nil t "*Org Agenda*")
#+end_src

Be aware that this will regenerate your *Org Agenda* buffer, so either
use sticky agendas or export agendas in separate emacs process.


But I would highly recommend using org-ql for these purpouses. Besides
pretty solid and easy-to-use interface it is noticably faster.

Here is the snippet I am currently using to export all subtress directly
tagged with :info: to the separate file. (Sorry for the lack of proper
parametrisation).

#+begin_src emacs-lisp
(defun org-user/store-info ()
  (let ((file "~/org/cals/info.org")
(heading (org-format-outline-path (org-get-outline-path t
(save-excursion
  (org-copy-subtree)
  (find-file file)
  (end-of-buffer)
  (org-paste-subtree)
  (org-edit-headline heading

(defun org-user/export-info ()
  "Export all information entries into one file."
  (find-file "~/org/cals/info.org")
  (erase-buffer)
  (insert "#+TITLE: Information")
  (org-ql-select
(org-agenda-files)
'(tags-local "info")
:action #'org-user/store-info)
  (save-buffer))
#+end_src

You need to invoke (org-user/export-info), obviosuly.



Re: Anyone use 3rd party search tools w/org-mode?

2019-11-13 Thread Roland Everaert
It is not a question of searching and replacing strings in one file, but
searching for a document or a set of documents among tenth of document or
even more, possibly in various format.

Roland.
briangpowell . writes:

> Emacs (shortened name from "Editor Macros") has the fastest Regular
> Expression engine in the world--when you compare the engines that are
> programmed to find and display character strings AS YOU TYPE THEM.
>
> So, just hoping you keep that in mind: As far as editing documents and
> searching documents and in some cases replacing strings, there is nothing
> faster than Emacs and its native regular expression engine, which is built
> for editing tasks--editing tasks that are especially related to and
> programmed for searching strings and/or regular expressions as you type
> them in
>
> In many other ways, of course other engines are faster; but, not for
> editing and searching and replacing tasks
>
> And even when you talk about editing multi-gigabyte and even multi-terabyte
> files--suggest you look into and try out vlf-mode (i.e. "Very Large File
> Mode") for that, just for the fun and excitement of it, if for nothing else.
>
> So, again, GNU Emacs is by far the world's most powerful editor, and it has
> been for many, many years--there is no need for 3rd party tools, maybe
> there's a need to investigate the "engines under the hood" and why they
> work the way they do.
>
> On Tue, Nov 12, 2019 at 8:04 AM Russell Adams 
> wrote:
>
>> To further explain my setup, I have three libraries of files Personal,
>> Technical
>> and Business. Personal is all personal data including Org files, Technical
>> is
>> all whitepapers and vendor documentation, and Business is Org projects and
>> other
>> matters. Recoll is used to search all of them.
>>
>> In my shell profile I have a few functions to access each library, and to
>> file
>> away new documents (ie: I downloaded a whitepaper, and just want to slap
>> it into
>> a unique directory in the library).
>>
>> #+BEGIN_EXAMPLE
>>   # For recoll and library
>>   func _FileRecoll()  { DEST="$HOME/Library/$1/$(date +%Y/%m/%d)" ; mkdir
>> -p $DEST ; mv -i "$2" $DEST ; }
>>   func FileTech() { _FileRecoll "Technical" "$1" ; }
>>   func FilePersonal() { _FileRecoll "Personal"  "$1" ; }
>>   func FileBiz()  { _FileRecoll "Business"  "$1" ; }
>>
>>   func recollt() { RECOLL_CONFDIR=~/Library/.recoll-Technical
>> ~/scripts/recolltui.sh $@ ; }
>>   func recollp() { RECOLL_CONFDIR=~/Library/.recoll-Personal
>> ~/scripts/recolltui.sh $@ ; }
>>   func recollb() { RECOLL_CONFDIR=~/Library/.recoll-Business
>> ~/scripts/recolltui.sh $@ ; }
>> #+END_EXAMPLE
>>
>> I have a daily cronjob to index those directories:
>>
>> #+BEGIN_EXAMPLE
>>   # Recoll
>>   00 2  * * * /usr/bin/recollindex -c ${HOME}/Library/.recoll-Personal/
>> >> "${HOME}/Library/.recoll-Personal/recollindex.log" 2>&1
>>   00 3  * * * /usr/bin/recollindex -c ${HOME}/Library/.recoll-Technical/
>> >> "${HOME}/Library/.recoll-Technical/recollindex.log" 2>&1
>>   00 4  * * * /usr/bin/recollindex -c ${HOME}/Library/.recoll-Business/
>> >> "${HOME}/Library/.recoll-Business/recollindex.log" 2>&1
>> #+END_EXAMPLE
>>
>> Then I have a simple TUI shell script which wraps dialog around recoll's
>> CLI. This puts the filename in my clip board for command line pasting, and
>> opens
>> PDFs in Firefox.
>>
>> #+BEGIN_EXAMPLE
>>   #!/bin/sh
>>   # ~/scripts/recolltui.sh
>>
>>   # requires recollq optional cli binary to be present from recoll package
>>   # uses base64, xsel, and dialog
>>
>>   DB=$(mktemp)
>>   MENU=$(mktemp)
>>   trap 'rm -f -- "${DB}" "${MENU}"' INT TERM HUP EXIT
>>
>>   # Make sure to customize RECOLL_CONFDIR (ie:
>> ~/Library/.recoll-Technical) if needed
>>
>>   # query recoll, save the base64 output to $DB as 3 space separated
>> columns: row #, title, url
>>   recollq -e -F "title url" $@ 2>/dev/null | nl > $DB
>>
>>   # copy header into menu
>>   head -n 2 $DB | while read num rest ; do
>>   echo "= \"$rest\"" >> $MENU
>>   done
>>
>>   # Convert results to dialog menu using row # and title + filename as
>> list item
>>   # skip first two lines of results, they are not base64
>>   tail -n +3 $DB | while read num title url ; do
>>   echo "$num \"$(echo "$title" | base64 -w0 -d ) : $(basename "$(echo
>> "$url" | base64 -w0 -d | sed 's,file://,,g')")\"" >> $MENU
>>   done
>>
>>   # ask the user which results to view
>>   SEL=$(dialog --menu "Search results" 0 0 0 --file $MENU --stdout)
>>
>>   # if a choice was made, open the url in firefox AND copy it to the
>> clipboard
>>   [ $? -eq 0 ] && {
>>   URL="$(awk "\$1 == $SEL  {print \$3}" $DB | base64 -w0 -d)"
>>   echo "$URL" | sed 's,file://,,g' | xsel
>>   firefox "$URL"
>>   }
>>
>> #+END_EXAMPLE
>>
>> I've often thought that the dialog script could be easily replaced by an
>> Emacs
>> interface, but I haven't taken the time to try to write one.
>>
>> I've found that recoll's indexing in Xapian is excellent. I freque