Re: Stripping captured journal entries

2024-01-05 Thread Michael Welle
Hi,

"Loris Bennett"  writes:

> Hi,
>
> I capture journal entries such as
>
>   * 2024-01 January
>
>   ** 2024-01-03 Wednesday
>
>   *** Did this
> Added: [2024-01-03 Wed 10:35]
> - foo
>
>   *** Did that
> Added: [2024-01-03 Wed 12:13]
> - bar
>
>   ** 2024-01-04 Thursday
>
>   *** Did something else
> Added: [2024-01-04 Thu 09:53]
> - foobar
>
> I would like be able to extract a simple list of the headlines below the
> dates across multiple dates, i.e.
>
>   *** Did this
>   *** Did that
>   *** Did something else
>
> However, I only want some of the entries within the month, specifically,
> just those within a given week.

maybe you can use (org-map-entries 'org-get-heading "LEVEL=3") as a
starting point.

Regards
hmw



special blocks extras

2023-02-26 Thread Michael Welle
Hi,

I wanted to play with special blocks and started by installing the
package org-special-block-extras and defining a new block:

(org-defblock hmwfoo nil (reps 3)
  "Ahoj"
  (message "ahoj: %s" contents)
  (org-parse (s-repeat reps contents)))

For the tests I started with exporting to html.

A link like [[hmwfoo:][oink]] seems to work, I see three concatenated
oinks.

A block like

#+begin_hmwfoo
oink
#+end_hmwfoo

exports to only one single oink. According to my understanding both, the
link and the block, should be equivalent?

Well, then I activated the special block extras minor mode before
exporting and things got strange. The link still seems to work, but the
block results in an html page rendered like this:

#+end_export oink

oink

oink

#+begin_export html

Three oinks, but lots of line breaks and the export markers are part of
the rendered page. Hm, that's not what I expected ;). Do I use it the
wrong way or is there a bug hidden somewhere?

All the best
hmw



Re: Exporting images to different output formats

2022-11-01 Thread Michael Welle
Hello,

Ihor Radchenko  writes:

> Michael Welle  writes:
[...]
>> {{{img(./foo, foo, barfoo)}}}
>>
>> That kind of works (and breaks if I want commas in the caption)
>
> Re: commas. See 13.5 Macro Replacement
I found that shortly after posting. Works as expected.


>(1) Since commas separate the arguments, commas within arguments have
> to be escaped with the backslash character.  So only those backslash
> characters before a comma need escaping with another backslash
> character.
>
>> , but is
>> ugly as... and doesn't get better if I implement the other output formats.
>
> Agree. The proper way to implement this is special blocks + custom
> export filter that will take care about backend selection.
>
> Also, see https://list.orgmode.org/orgmode/87y1yr9gbl@gmail.com/
> referring to https://github.com/alhassy/org-special-block-extras/
Ah, that looks promising.

Thank you!

All the best
hmw



Exporting images to different output formats

2022-10-29 Thread Michael Welle
Hello,

I want to export to different output formats. Trouble is the way ox-gfm
exports images. So I thought, hm, why not utilise macros to abstract away
the differences. Well, that escalated quickly:

#+macro: img_gfm (eval (concat "#+begin_export md\n![img](" $1 " \"" $2  
"\")\n*Abb.: " $2 "* (Quelle: " $3 ")\n#+end_export"))

#+macro: img_latex (eval "foobar")

# Image export for Github flavoured markdown
# $1 path to image
# $2 caption
# $3 source
#+macro: img (eval (cl-case org-export-current-backend ('gfm (concat 
"{{{img_gfm(" $1 "," $2 "," $3")}}}")) ('latex "{{{img_latex}}}") (t "barfoo")))


{{{img(./foo, foo, barfoo)}}}

That kind of works (and breaks if I want commas in the caption), but is
ugly as... and doesn't get better if I implement the other output formats.

Maybe syntax like @@latex: ...@@ would help. But no, I think that is
defined in the specific backends, not as a general mechanism.

So, how can I do it better?

All the best,
hmw



Re: Org 9.6-pre and Bash sessions

2022-10-13 Thread Michael Welle
Hello,

Rudolf Adamkovič  writes:

> Hello there!
>
> I noticed today that Bash source blocks with ':session" does not seem to
> work with Org 9.6-pre (3e8648775).  Does anyone else have the problem?
funnily I observed something similar while generating semester projects
for my students.

Example:

#+name: seprj_conf_table
| xxxzwei | 234 2bar|
| xxxeins | 2342bar |
| xxxdrei | ${eins} |

#+begin_src sh :session foo :var conf=seprj_conf_table :separator =
  IFS=$'^\n\t'
  for val in "$conf" ; do
eval "export '$val'"
  done
  env |grep xxx
#+end_src

With main this hangs until C-g. I have an other machine with a little bit
older Org:

commit 9b62bcc9c60302467d1d45b6c240057e80fce656 (HEAD)
Author: Lars Ingebrigtsen 
Date:   Sat Sep 24 15:17:23 2022 +0200

Backport commit 8dacd8cd9 from Emacs

That works as expected. So I guess the regression was introduced within
the last week or two.

Regards
hmw



Re: reference a remote named block in #+CALL: line

2021-11-02 Thread Michael Welle
Hello,

Matt Price  writes:

> I am getting used to calling library-of-babel functions with local data
> structures as input variables, e.g. in this line:
>
> #+CALL: list2table(data=common-issues-list, order="rows") :results  table
>  raw
[...]
> In this particular case, I'd like to maintain a single data structure and
> use it in a bunch of places (it's a document I re-use in several courses,
> all of which are published online with different metadata stored in
> headings). Is there a syntax for referring to #+NAME'd elements in remote
> files?
that's what I use with tables (but that should not matter):

#+CALL: list2table(data=data.org:common-issues-list, order="rows") :results  
table raw

Regards
hmw



Re: could a :var header argument refer to a data table in another file?

2021-04-30 Thread Michael Welle
Hello,

Eric S Fraga  writes:

> Hello all,
>
> TL;DR: I have the need to reference a table that is in another file to
> pass as data to a src block in the current file.  Is this possible?
> Hints welcome!
I smell something strange going on here ;). For every Org related
question I had in the last few weeks I found at least one other person
that had the same question roughly at the same time.

I use Org to generate projects, import stuff, set permissions etc. on
several servers for a software engineering course. I think it would be
nice to separate the student's personal data in Org tables from the Org
code that get checked into a repository.

My first attempt was :var data=data.org::remote-table, but the familiar
double colon didn't work, the single colon indeed did the trick.

Regards
hmw



Generating documentation about Org from random org file

2021-04-03 Thread Michael Welle
Hello,

the subject is a bit unmeaning, so let me explain. I have an Org file
implementing a real use case. The file consists of documentation of the
use case, of code blocks and all the other stuff. That's mostly fine.

Now I want to use this file to showcase the use case a bit, but also to
produce documentation about Org, about how to solve a problem with Org.
Therefore I want to show the code blocks, but this time with the
begin/end tags, with header parameters etc. Is there a nice way to do
that without too much code duplication and convolution? Or should I just
copy the file and separate the use case and the showcase one?

Regards
hmw



Re: How to get a table into a variable in a shell code block?

2021-04-03 Thread Michael Welle
Hello,

William Denton  writes:

> On 3 April 2021, Greg Minshall wrote:
>
>> #+begin_src shell :results output :var n=numbers
>> echo ${n[1]}
>> #+end_src
>
> Aha, it's in an array but I didn't see it!  Thanks.  Org was doing it magic 
> but
> I got confused by bash.
interestingly I asked a similar question in #org-mode yesterday. I came
up with this approach:

* table test
** user data
#+name: userdata
| uid | name | foo   | bar  |
| a2s | a2   | afoo  | abar |
| b2s | b2   | bfoo  | bbar |
| c2s | c2   | c foo | cbar |

** code
#+begin_src sh :var userdata=userdata :separator , :results raw
  echo "$userdata" | while read line ; do
  IFS=','
  echo "$line" | while read u n f b ; do
  echo "u: $u n: $n f: $f b: $b"
  done
  done
#+end_src

This looks a bit clumsy, but should also work with shell that doesn't
support (2D) array type variables.

Regards
hmw



Re: Release Org 9.4

2020-09-14 Thread Michael Welle
Hello,

Bastien  writes:

> Dear all,
>
> Org 9.4 is out.  Enjoy!
I do!

Thank you! And thank you to all contributors.

All the best
hmw



Re: Support for simultaneous running clocks?

2020-09-12 Thread Michael Welle
Hello,

Samuel Wales  writes:

> more than one clock can be useful, but maybe need not be org-related,
> even if that would be nice?  for example, your laundry is due in 45m,
> tea will be steeped in 8m, etc.
for that exactly that use case ;) I have a small shell script that
creates at jobs and pops up a msg box when laundry is due. With an elisp
wrapper it's easy to M-x it from Emacs. Nothing fancy or elaborated, but
it works for me.

Regards
hmw




Re: org-sbe and code blocks in a different files

2020-07-09 Thread Michael Welle
Hi Charles,

"Berry, Charles" via "General discussions about Org-mode."
 writes:

>> On Jul 9, 2020, at 12:09 AM, Michael Welle  wrote:
[...]
> Not stupidity. AFAICS there is no call in org-sbe to
> org-babel-lob-get-info, so the params are not updated. I supposed this
> counts as a bug.
>
> As a workaround
>
> #+TBLFM: $2='(org-babel-ref-resolve "boing(range=23)")
finally I came up with this for my real use case:

#+TBLFM: $2='(org-babel-ref-resolve (format
 "convert-time-range-to-days(range=\"%s\")" $1))

Thanks everyone.

Regards
hmw



Re: org-sbe and code blocks in a different files

2020-07-09 Thread Michael Welle
Hi Douglas,

Douglas Perrin  writes:

> Hi Michael,
> Maybe I am not understanding what you want to do but I use
> org-babel-lob-ingest/org-sbe to execute blocks from other files on
> start-up like this:
> # Local Variables:
> # eval: (org-babel-lob-ingest "Template-Loader.org")
> # eval: (org-sbe "Init-Template") ;; the name of a block
> in Template-Loader.org file
> # End:
>
> I assume this means that org-sbe can see the block names from the other
> file. But I haven't tested the behavior with #call just executing elisp.
> Doug
thanks for bringing that up again. Your example works, of course. After
further inspection I think that variables kill my example:

This code block comes from a file I processed with org-babel-lob-ingest.
o-b-l-i returns the correct number of code blocks in that file and org-bab

#+name: boing
#+begin_src elisp :var range=42
(message "Hello, crude world: %s" range)
#+end_src

This comes from the file where I want to use the code block:

|+|
| <2020-02-19 Wed>--<2020-02-21 Fri> | #ERROR |
#+TBLFM: $2='(org-sbe "boing" (range 23))

That fails. After removing the variable from the code block and from
org-sbe it works as expected. It works as well if I copy the code block
including the variable into the file with the table. Might be a bug or
my own stupidity?

Regards
hmw



Re: org-sbe and code blocks in a different files

2020-07-08 Thread Michael Welle
Hi Eric,

Eric S Fraga  writes:

> * org-babel-lob-ingest
ah, I learned something new here. Unfortunately, it seems like org-sbe
doesn't look into the list spit out by org-babel-lob-ingest.

Regards
hmw



org-sbe and code blocks in a different files

2020-07-07 Thread Michael Welle
Hello,

I can execute code blocks in different (separate?) files like this:

#+call: ../lob.org:convert-time-range-to-days(range="<2020-02-19
 Wed>--<2020-02-21 Fri>")

That is great. Can I call the same function from a table function?
org-sbe doesn't support the above notation extended with an Org file
name, I think.


Second, I try to concentrate useful reusable code blocks in one file,
lob.org in my case. That works. But I feel that I need some of the elisp
based code blocks as code blocks, that I can execute, as well as
separate elisp forms that I can eval from elisp code. How to deal
with that?

Ideas:

Having two code blocks per function: one with the actual elisp code that
can be tangled and a second one that just evals the form and can be used
as a, well, code block usable with #+call?

Or should I give them names like func and func_code (that's the one with
actual elisp code) and write an elisp form that grabs all code blocks
named *_code and evals them at start-up to bring the forms into the
environment?

Other ideas are also welcome.

Regards
hmw



Re: #+call and strange behaviour

2020-06-24 Thread Michael Welle
Hello again,

sorry, for the noise. Just minutes after posting the question I
discovered the difference between the org files: they are stored in
different sub-directories. Fixing the path solved my problem:

#+call: ../test.org:hcw(d="foo")

Seems like rubber ducking kind of works ;).

Regards
hmw



#+call and strange behaviour

2020-06-24 Thread Michael Welle
Hello,

in a file named test.org I have an elisp src code block and a line like
this:

#+call: test.org:hcw(d="foo")

C-c C-c on that line executes the code block just fine. Copying the line
to another org file and pressing C-c C-c results in nothing obvious. On
the other hand, putting a code block in this other org file C-cC-c works
as expected again on a line such as this:

#+call: other.org:hcwother(d="foo")

It seems like it doesn't work if one references a code block in a file
that isn't the current/own file of the reference. Any hints on this,
please?

Regards
hmw



Re: emacs + org-mode in virtual machine/docker/...

2020-05-21 Thread Michael Welle
Hello,

John Kitchin  writes:

> yes it is interactive use I am most interested in. I am exploring this as a
> potential option for students to use in a class.
well, I don't do this for Emacs specifically, but for the compilers,
tools, etc. I need in operating system and systems programming courses.
A surprisingly huge number of students struggle with installing the
needed tools on their systems and it is always very time consuming for
us to try fix their problems (different OS, different compilers, etc.
ppp.). Since about a year I hand out pre-configured VM images that can
be imported into Virtualbox, VMWare, etc. That way we only need to
support the installation of a single product (we encourage the students
to use Virtualbox). That works out quite good. Typical problems are:
student can't figure out that their disk is full, virtualisation
extension of the hardware is disabled in firmware, student uses hardware
with not enough RAM or disk capacity. Very rarely the students own
hardware that don't allow to enable the virtualisation extension, I had
that once or twice. And there are always a few students who seem to have
strange random problems and when we ask for details the students don't
show up again.

Regards
hmw



Re: Org <-> Gitlab Wiki

2020-04-08 Thread Michael Welle
Hello,

Albert Krewinkel  writes:

> Hi,
>
> Michael Welle writes:
>
>> using ox-gfm to export Org to Gitlab's markup syntax (for the wiki for
>> instance) seems to work quite nice. Gitlab's Org parser has some
>> shortcomings, so using Org syntax directly in Gitlab often results in
>> strangely rendered documents. What I'm interested in is a 'roundtrip
>> workflow'. If someone else changes the wiki, is there a way to get that
>> changes back and merge it semi-automatically into the Org file? I guess
>> I have to check out the wiki repository, get the diff between the two
>> markup versions and then apply that manually to the Org file.
>
> Your should be able to take a shortcut here by using pandoc for the
> conversion back to org. It might even make sense to use pandoc for the
> opposite direction as well, but org-mode exporters are usually better at
> that.
>
> See https://pandoc.org and https://pandoc.org/org.html
ah, good idea. That might help.

Regards
hmw



Org <-> Gitlab Wiki

2020-04-08 Thread Michael Welle
Hello,

using ox-gfm to export Org to Gitlab's markup syntax (for the wiki for
instance) seems to work quite nice. Gitlab's Org parser has some
shortcomings, so using Org syntax directly in Gitlab often results in
strangely rendered documents. What I'm interested in is a 'roundtrip
workflow'. If someone else changes the wiki, is there a way to get that
changes back and merge it semi-automatically into the Org file? I guess
I have to check out the wiki repository, get the diff between the two
markup versions and then apply that manually to the Org file.

Regards
hmw



Visual index for Org based presentation slide sets

2019-12-27 Thread Michael Welle
Hello,

Christmas time is also the time when the heating in the office is shut
off. Time to think about not so essential things ;).

On [0] you will find an index of reveal based presentations. Is there
something similar for Org based presentations? Maybe even a visual
index? Something where you can learn and stea^Wborrow ideas? If not,
should there be something like that?

Regards
hmw

[0] https://github.com/hakimel/reveal.js/wiki/Example-Presentations



begin_src latex -> pdf

2019-12-26 Thread Michael Welle
Hello,

this works as expected:

#+begin_src latex  :file foo.png :exports results :results file raw
Hello, crude world
#+end_src

foo.png is created in the org file's directory. Shouldn't the
following do the same, except with a pdf file?

#+begin_src latex  :file foo.pdf :exports results :results file raw
Hello, crude world
#+end_src

When cc'ing that block I got this message:

Evaluate this latex code block on your system? (y or n) y
executing Latex code block...
Processing LaTeX file /tmp/tmp_welle/latex-sCpRjQ.tex...
org-compile-file: File "/tmp/tmp_welle/latex-sCpRjQ.pdf" wasn’t produced.  See 
"*Org PDF LaTeX Output*" for details

The mentioned log buffer doesn't indicate an error.

In the org file's directory I find

 -rw-rw  1 welle welle  8 Dec 27 08:14 latex-sCpRjQ.aux
 -rw-rw  1 welle welle  34823 Dec 27 08:14 latex-sCpRjQ.log
 -rw-rw  1 welle welle  12433 Dec 27 08:14 latex-sCpRjQ.pdf

The pdf file is correct.

I /tmp/tmp_welle I find

 -rw---  1 welle welle  907 Dec 27 08:14 latex-sCpRjQ.tex

It seems like parts of org think the compilation is done in the tmp
dir, while the cwd (where compilation results are stored) is the org
file's dir. 


Regards
hmw



Re: Babel: Store script in external file

2019-12-16 Thread Michael Welle
Hello,

Nathan Neff  writes:

> Hello all,
>
> I think I'm missing something basic:  I'd like to have something like this:
>
> #+begin_src python
> #+filename: foo.py
>
> Instead of storing my Python code in the current org file, I would like
> Babel to read foo.py and execute it, as if it was inside the .org file.
>
> The foo.py mentioned above is fairly large, and I would like the code
> to be stored in a different file than my .org file, for brevity.
>
> Any ideas?  I feel like I'm missing something obvious.
either put some Python code into your Python src block that executes
your external script. Or use a shell|elisp|whatever src block that
executes your script.

Regards
hmw



Re: [O] Creating a (RabbitMQ) diagram

2019-10-19 Thread Michael Welle
Hello,

"Fraga, Eric"  writes:

> On Thursday, 17 Oct 2019 at 15:21, Cecil Westerhof wrote:
>> I tried it out (after a bit of configuring) with the following:
>>
>> #+BEGIN_SRC plantuml :file groupingComponents.eps :noexport
>
> [...]
>
>> It looks a bit different, but I will not worry about it at the moment.
>
> I use the following tools within org for eventual export to PDF via
> latex: tikz, ditaa, graphviz (dot, neato, ...), & plantuml.  I've even
> bee known to use LaTeX's own picture environmnt.  They each have
> different advantages and disadvantages but all work well with org in my
> opinion.
so think and do I. At the moment I try to consolidate the tools I use
and try to get away with tikz only. I tried to reproduce same diagrams I
created with plantuml. Well, it works. But there are a lot of details in
plantuml's output that you have to do manually with tikz. BTW, I just
discovered that plantuml's pdf output is way different from its LaTeX
output.

Regards
hmw



Re: [O] Inserting todo time range

2019-06-27 Thread Michael Welle
Hello,

Raimund Kohl-Füchsle  writes:
[...]
> If instead I would use
>
>** TODO Test Time range
>
>     <2004-08-23 Mon>--<2004-08-26 Thu>
>
> then this for org-mode would just be one todo; if I mark it done on
> Mon all other days are marked as done, too.
>
> So how would I schedule a daily TODO only, say, this week from Mo -
> Fr?
well, I think there are only wuerg-arounds to gain the desired
behaviour. First, you can use a sexp to specify the days on which your
task will be inserted into your agenda:

SCHEDULED: <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>

But with that your task is done when you set it to done. Something
like the following isn't perfect, but seems to work:


** TODO foobar
   DEADLINE: <2020-01-04 Sat +1d>
   SCHEDULED: <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>
   [2019-03-31 Sun] 
   

Regards
hmw

-- 
FrOSCon? Free and Open Source Software Conference
10th + 11th August 2019, Sankt Augustin, Bonn Area/Germany
https://www.froscon.de/en/



Re: [O] org-capture template to type in bills from shops in ledger format

2019-06-02 Thread Michael Welle
Hello,

Stefan Huchler  writes:

> I wrote this template to capture my bills from mostly one shop, but it
> has support for multiple shops and the important feature is that it
> suggests previous item names and remembers last prices, that gives you
> lot's of autocompletion if you repetetivly buy often the same stuff over
> and over again.
nice. I do something similar with a simple Perl script and an SQL
database as a backend and sometimes I mull over about what's wrong
with me ;). On the other hand, I've Org tables telling me when I got
hair cuts in the last 10 years or so.

Regards
hmw



Re: [O] org-tempo violating org-mode conventions since 9.2

2019-01-26 Thread Michael Welle
Hello,

Tim Cross  writes:

> I totally agree that block delimiters should be case
> insensitive. However, I think the ability for a user to set their
> preference for either upper case or lower case is reasonable. It does
> not need to affect the syntactic interpretation, just whether the
> template system does it in upper case or lower case. I have no idea how
> much more complex this would make the tempo definitions though.
ah, I understand. I had the generating part as well as the parsing part
in mind when I wrote my last posting. But you are right, making
customisable how the blocks are generated wouldn't hurt anyone, I think.
Maybe it is enough to change org-create-dblock, maybe there are more
places to look at.

Regards
hmw



Re: [O] org-tempo violating org-mode conventions since 9.2

2019-01-26 Thread Michael Welle
Hello,

Amin Bandali  writes:
[...]
> I think it would be nice to provide a defcusom to allow choosing between
> upper vs. lowercase.
that would make the exchange of Org files with colleagues and other Org
aficionados complicated, wouldn't it? As Nicolas said, blocks are
case-insensitive, meaning one could write them down according to one's
liking ;). 

Regards
hmw

-- 
FrOSCon? Free and Open Source Software Conference
10th + 11th August 2019, Sankt Augustin, Bonn Area/Germany
https://www.froscon.de/en/



Re: [O] how do I search state change dates?

2019-01-12 Thread Michael Welle
Hello,

"Christopher W. Ryan"  writes:

> This looks promising. However, the example at the link you referenced
> seems to have its state changes inside a LOGBOOK property drawer. My
> state changes are not inside a drawer. See excerpt below.
the shown code should be able to deal with both situations, but it's not
much tested without drawers. It's just...


> To change the
> state, say from TODO to READING, I use C-c C-t and then can choose one
> of my pre-specified states.  Should I put my state changes in a LOGBOOK
> drawer? If so, how does that work?
... that using drawers is my personal preference. I think it looks
cleaner. I have tasks with pages full of state data. It's nice to be
able to fold the drawer and hide the data. The behaviour can be changed
by setting the variable org-log-into-drawer.

Regards
hmw



Re: [O] how do I search state change dates?

2019-01-02 Thread Michael Welle
Hello,

"Christopher W. Ryan"  writes:

> I try to keep track of books I want to read, and when I eventually read
> them.  I use TODO keyword for books I intend to read, and I change the
> state to READING and then DONE, as appropriate. Each state change gets a
> date/time stamp.
at [0] you will find a bit of code (org-task-dump-logs.el) that
retrieves all the log data for a given task. Maybe that is helpful if
you extend it with a loop that iterates over all tasks of a file.

Regards
hmw

[0] https://www.c0t0d0s0.de/otdl/otdl.html



Re: [O] Possible bug in org-mode (MELPA version as of 1018-11-25) : #+language: is not (fully) honored.

2018-11-27 Thread Michael Welle
Hello,

Emmanuel Charpentier  writes:

> As of today, I note that the #+langiage export variable is no longer
> honored when exporting to LaTeX/PDF. See enclosed files :
I noticed this quite some time go (months, last year maybe), but didn't
dived into it because I'm not sure what to expect. ox-latex suggest that
this might be the way to go:

#+LATEX_HEADER: \usepackage[AUTO]{babel}


Regards
hmw



Re: [O] How to make agenda generation faster

2018-10-11 Thread Michael Welle
Hello,

Marcin Borkowski  writes:

> On 2018-10-08, at 09:20, Michael Welle  wrote:
[...]
>> Well, on my laptop the initial agenda run takes about 7s or so (150
>> agenda files) using the current day/week agenda ("a"). All subsequent
>> (after loading the files) agenda runs are fast (split second I would
>> say). I had some performance issues in the past caused by SCM. Emacs
>> tried to check if every file is checked out in the latest version. That
>> slowed down the process a lot (starting 150 mercurial processes in
>> sequential order, checking results, etc.). The initial run doesn't
>> bother me much. I bound the initial agenda run to an idle timer at Emacs
>> start. 
>
> Interesting.  I did not notice such differences between the first and
> subsequent runs.
I thought that behaviour is natural, scanning dirs for files and opening
them is a costly operation. But a week ago I changed from rotating rust
to solid state disks and that behaviour did not change much. I expected
a speed up, but mee. 

Regards
hmw



Re: [O] How to make agenda generation faster

2018-10-11 Thread Michael Welle
Hello,

Marcin Borkowski  writes:

> On 2018-10-09, at 13:47, Julius Dittmar  wrote:
>
>> Hi Marcin,
>>
>> I can't advise as to profiling to find out what really bogs down agenda
>> building.
>>
>> I found that log messages do bog it down.
>>
>> I have a lot of recurring tasks, which accumulate log entries for every
>> closing (which in fact means rescheduling to the next day). Every two to
>> three months I prune my org files of those log entries. This
>> significantly speeds up agenda building.
>
> By experiments, I found that the main bottleneck was a file with lots (=
> a few thousand) headlines.
ah, interesting. My org files usually aren't that deeply structured, so
I don't get hit by that. Hm, I guess regexps are used to find headlines?

Regards
hmw



Re: [O] How to make agenda generation faster

2018-10-08 Thread Michael Welle
Hello,

Marcin Borkowski  writes:

> Hi Orgers,
>
> my agenda takes almost 10 seconds to show up.  Are there any ideas for
> profiling that?
>
> I suspect that archiving a lot of old entries I don't use anymore might
> help, but is there any way to e.g. display some stats on which
> file/headline took how much time?
since no one answered yet, there are some similar threads. IIRC the way
to go is to use elp for profiling.

Well, on my laptop the initial agenda run takes about 7s or so (150
agenda files) using the current day/week agenda ("a"). All subsequent
(after loading the files) agenda runs are fast (split second I would
say). I had some performance issues in the past caused by SCM. Emacs
tried to check if every file is checked out in the latest version. That
slowed down the process a lot (starting 150 mercurial processes in
sequential order, checking results, etc.). The initial run doesn't
bother me much. I bound the initial agenda run to an idle timer at Emacs
start. 

Regards
hmw



Re: [O] Concatenating Org property values from parent subtrees

2018-09-29 Thread Michael Welle
Hello,

Michael Welle  writes:
[...]
> (defun hmw/org-prop-append(prop value)
>   (save-excursion
>   (org-up-heading-safe)
>   (format "%s %s" value (cdr (assq prop
>(car 
> (org-babel-params-from-properties)))
>
> (defalias 'A 'hmw/org-prop-append)

and I just realise that it works with code blocks only. I guess the way
to get general property values has to be adapted.

Regards
hmw



Re: [O] Concatenating Org property values from parent subtrees

2018-09-29 Thread Michael Welle
Hello,


Kaushal Modi  writes:

> On Sat, Sep 29, 2018 at 2:39 PM Michael Welle  wrote:
>
>>
>> I asked something similar earlier this year (concatenating compiler
>> flags given as header-args property, used for linking against different
>> libs in different sections of the Org file). I ended with a function
>> that grabs the current property value and returns the value concatenated
>> with new value. That function can be used as a 'property value'. That's
>> not a nice and bullet proof solution, but works good enough to me to
>> generate the solutions to the psets for the lecture.
>>
>
> Please share it if you don't mind. I plan to use it or its derivative in
> ox-hugo. The property is planned to be a path property, and with nested
> property values of "a","b" and "c", which I want to parse as "a/b/c".


(defun hmw/org-prop-append(prop value)
  (save-excursion
  (org-up-heading-safe)
  (format "%s %s" value (cdr (assq prop
   (car (org-babel-params-from-properties)))

(defalias 'A 'hmw/org-prop-append)


I use it like this:


* foo
 :PROPERTIES:
 :header-args: :flags -Wall
 :END:

** bar
#+begin_src C :flags (A :flags "-lm")
#+end_src

** baz
 :PROPERTIES:
 :header-args: :flags (A :flags "-lcunit")
 :END:

#+begin_src C
#+end_src


Regards
hmw



Re: [O] Concatenating Org property values from parent subtrees

2018-09-29 Thread Michael Welle
Hello,

Kaushal Modi  writes:

> Hello,
>
> Is there a way to achieve something like below? See the content in each
> nested subtree in the example below.
I asked something similar earlier this year (concatenating compiler
flags given as header-args property, used for linking against different
libs in different sections of the Org file). I ended with a function
that grabs the current property value and returns the value concatenated
with new value. That function can be used as a 'property value'. That's
not a nice and bullet proof solution, but works good enough to me to
generate the solutions to the psets for the lecture.

Regards
hmw



[O] ob-sql, quoting SQL wildcards

2018-05-12 Thread Michael Welle
Hello,

I try to fetch some values from an sqlite database (want to grab some
statistics from Zotero ;)):

#+begin_src sqlite :db zotero.sqlite
select value from itemdatavalues where lower(value) like '%gelesen%';
#+end_src

The SQL wildcards cause trouble:

Evaluate this sqlite code block on your system? (y or n) y
executing Sqlite code block...
Wrote /tmp/tmp_welle/babel-82601NB/ob-input-8260GeN
org-babel-read: End of file during parsing


I guess I have to quote the wildcards. But how?

Regards
hmw



Re: [O] (no subject)

2018-05-03 Thread Michael Welle
Hello,

Bastien  writes:

> Dear Arne,
>
> there was a temporary glitch in earlier version of Org about this,
> please upgrade Org to 9.1.12 through the package system and let us
> know if you still have this issue.
oh, i thought that is a feature of some kind. Let me upgrade... Hm, the
feature|issue still exist in 9.1.12.

The issue occurs if the capture buffer isn't finished with a newline. My
workaround:

;;
;; Since some time Org does not prepend a \n after inserting
;; a capture template. We fix this ;).
;;
(defun hmw/org-insert-newline-after-template ()
  (goto-char (point-max))
  (if (not (re-search-backward "\\(^$\\)" (point-at-bol) t))
  (progn
(goto-char (point-max))
(insert "\n"

(setq org-capture-prepare-finalize-hook
  'hmw/org-insert-newline-after-template)

Regards
hmw



Re: [O] How to let ob-shell to download file and get result as a link to file?

2018-03-26 Thread Michael Welle
Hello,

stardiviner  writes:

> I tried the following example:
>
> ```
>
> #+begin_src shell :mkdir yes :dir "data/tmp" :results file :file 
> "crackzor_1.0.c.gz"
> wget -c "http://ben.akrin.com/crackzor/crackzor_1.0.c.gz;
> #+end_src
>
> #+RESULTS:
> [[file:data/tmp/crackzor_1.0.c.gz]]
> ```
>
> But the files is empty, I check out Org-mode document about `:file` 
> header argument, seems org-babel will write result to `:file` specified 
> file. I wander how I can handle upper case correctly? (don't write 
> result to file, just insert a link to downloaded file as a result)
well, your above example would work, at least to a certain point, if you
let wget write its output to stdout:

#+begin_src sh :mkdir yes :dir "/tmp" :results file :file "crackzor_1.0.c.gz"
wget -c "http://ben.akrin.com/crackzor/crackzor_1.0.c.gz; -O-
#+end_src

But I don't now know how to get the encoding right (I think that's the
problem). The zip file contains rubbish. What I would do instead is
something like this: 

#+begin_src sh :mkdir yes :dir "/tmp" :results raw :var fn="crackzor_1.0.c.gz"
/usr/bin/wget -c "http://ben.akrin.com/crackzor/${fn};
echo "[[file:/tmp/${fn}]]"
#+end_src

Regards
hmw



Re: [O] How to escape # character in #+begin_src bash block for html export?

2018-03-26 Thread Michael Welle
Hello,

Nick Dokos <ndo...@gmail.com> writes:
[...]
> Michael Welle <mwe012...@gmx.net> writes:

> If you are trying to produce documentation and want to show commands
> that the user should type then you probably need an example block:
>
> #+begin_example 
> # date
> #+end_example
another idea: How about using shell code blocks for root commands as
well and attaching a CSS class to the block and colour the background?

Regards
hmw



Re: [O] How to escape # character in #+begin_src bash block for html export?

2018-03-25 Thread Michael Welle
Hello,

Abigaile Johannesburg  writes:

> Dear community,
>
> I have a minor question about how to escape '#' character in
> #+begin_src bash block. For example, when I export the source code
> block for bash, I can use
>
> #+begin_src bash
> $
> #+end_src
>
>
> But if I want to use # for indicating commands for root or privileged
> user, if I use
>
> #+begin_src bash
> #
> #+end_src 
>
> then the commands after '#' will be in italics, i.e., they are treated
> as comments in html export.
>
> How do I solve this problem?
I'm not sure if I understand your problem correctly. # starts a comment
in shell, and $ denotes (among others maybe) a variable name. In that
sense 

#+begin_src bash
$ls
#+end_src

delivers the value of the variable ls. The semantic of $ is not to
execute the command ls as a non-root user. Same goes for #. If you want
to put your own semantics into $ and # it might be better to not use a
bash code block.

If you want to note that some commands in a script needs root privilege,
maybe something like this would do the trick:

#+begin_src bash
ls
su - -c 'fdisk /dev/rdsk/c0d1/p0'
emacs&
#+end_src

Regards
hmw



Re: [O] Concatenating header args

2018-03-08 Thread Michael Welle
Hello,

Michael Welle <mwe012...@gmx.net> writes:
> Hm, the property values can be functions that get evaluated to get the
> actual property values, can't it? I'm not sure though if something like
> :flags (get-em "flags" '("-more" "-values")) is so much nicer to write.
> Maybe it is, esp. if you want to change the base flags for a ton of
> items. Today is teaching tuesday (even if it's wednesday ;)), so I'm a
> bit short on time. But I will try that approach later this week and see
> where that leads to.
not too nice, but works good enough for me ;).

(defun hmw/org-prop-append(prop value)
  (format "%s %s" value (cdr (assq prop
   (car (org-babel-params-from-properties))
(defalias 'A 'hmw/org-prop-append)


* foo
 :PROPERTIES:
 :header-args: :flags -Wall
 :END:
** bar

#+begin_src C :flags (A :flags "-lm")
#+end_src

Regards
hmw



Re: [O] Concatenating header args

2018-03-06 Thread Michael Welle
Hello,

John Kitchin  writes:

> I am pretty sure this isn't possible. The headers get overridden by the
> most local settings. There isn't a way to concatenate them. In some cases
> there isn't a way to figure out what you want, e.g. if a heading property
> said ":tangle no" and your header said ":tangle yes" it would not make
> sense to concatenate these to ":tangle no yes".
hm, I could think of a special syntax, like :tangle results in the
current behaviour and :+table concats values. That way it's up to the
user to express what she wants.


> I think you have to add -Wall to the src header.
Hm, the property values can be functions that get evaluated to get the
actual property values, can't it? I'm not sure though if something like
:flags (get-em "flags" '("-more" "-values")) is so much nicer to write.
Maybe it is, esp. if you want to change the base flags for a ton of
items. Today is teaching tuesday (even if it's wednesday ;)), so I'm a
bit short on time. But I will try that approach later this week and see
where that leads to.

Thanks
hmw



[O] Concatenating header args

2018-03-06 Thread Michael Welle
Hello,

how can I concatenate header args? Let's assume I have an Org structure
like follows:

* foo
 :PROPERTIES:
 :header-args: :flags -Wall
 :END:
** bar
#+begin_src C :flags -lm
#+end_src

Now I want the code to be compiled with -Wall _and_ -lm.

Regards
hmw



Re: [O] Why my config about org-log-reschedule didn't work?

2018-02-24 Thread Michael Welle
Hello,

"iany...@163.com"  writes:

> I think if I set the variable 
> (setq org-log-reschedule (quote time)) 
>
> When I change the schedule time of a task, a drawer will be created.
> But nothing happened as I did so. Even if I setuped a new emacs, with
> the only conifg line above. It still did not work.
> What did I missed? Thank you in advance.
hm, works for me with current Org mode. I guess you did not override the
log feature on a per file basis?

Regards
hmw



Re: [O] org-reveal: content side by side

2018-02-13 Thread Michael Welle
Hello,

i have to correct me.

Michael Welle <mwe012...@gmx.net> writes:

> Hello Jens,
>
> Jens Lechtenboerger <lech...@wi.uni-muenster.de> writes:
[...]
>> The howto for emacs-reveal is available at [1].  First-level
>> headings are centered vertically and horizontally.  I just added
>> slide 20 with horizontally centered text (underneath a heading,
>> which—as ugly hack—could just be a non-breaking space I guess).
> Well, maybe it's just me, but the headings do not look vertically
> centered. They jump up and down a lot while flipping through the
> slides.
the headings are vertically centered, of course, they jump up and down.
That's what I don't want. 

Regards
hmw



Re: [O] org-reveal: content side by side

2018-02-13 Thread Michael Welle
Hello Jens,

Jens Lechtenboerger <lech...@wi.uni-muenster.de> writes:

> On 2018-02-11, Michael Welle wrote:
>
>> Looks easy, eh? A header at the top, a footer at the bottom and a lot
>> of space in between. In some cases, like in [1], I wanted content (e.g.
>> Ich...OS/2 Warp 4) to be centered horizontally and
>> vertically between the footer and the header.
>
> I created emacs-reveal [0] for my own slides.  Contents are centered
jepp, I had a gander at that slides as well as at your slides for the OS
course. Great stuff.


> vertically (default for reveal.js).  CSS with “text-align: center”
> can be used for horizontal alignment.
>
> The howto for emacs-reveal is available at [1].  First-level
> headings are centered vertically and horizontally.  I just added
> slide 20 with horizontally centered text (underneath a heading,
> which—as ugly hack—could just be a non-breaking space I guess).
Well, maybe it's just me, but the headings do not look vertically
centered. They jump up and down a lot while flipping through the slides.
For slides with a lot of content the heading is a bit more to the top of
the page, for slides with less content the heading 'sinks down' to the
center of the page. If you look at page 20 the heading is just above the
vertical middle of the slide, not at the top.

That jumping of the headings is one of my main issues, I think it's not
acceptable. 

I can glue the headings to the top of the page (setting reveal-center to
nil). But then I have trouble centering the content. I tried with
putting in an empty  of a certain height. That works, for certain
meanings of work. The trouble is finding the height, which also might
change with changing resolution and content.

I have the feeling that all that can be fixed with using flex layout.
That means changing the CSS entirely, I think. But that is a lot of
work. On the other hand, I'm not a CSS expert.


> I hope that helps and would be happy to help more.  (Responses may
> be slow in the coming days, though.)
No worries. Your help is much appreciated.

Regards
hmw



Re: [O] org-reveal: content side by side

2018-02-13 Thread Michael Welle
Hello Eric,

Eric S Fraga <esfli...@gmail.com> writes:

> On Sunday, 11 Feb 2018 at 16:29, Michael Welle wrote:
>
> [...]
>
>> Until I will get bored again, I will stick with Org's beamer export
>> :)[2]. But anyways, if you want to share your experience with
>> ox-reveal, you are welcome.
>
> Every now and again, I also get bored and explore alternatives to beamer
> with org for presentations.
I'm glad I'm not the only one with that 'flaw' ;).


> Reveal is the one that has come the closest
> to working for me but I still end up back with beamer.
Don't get me wrong, reveal is fine. It's just that I can't (within an
appropriate amount of time) produce a slide with the layout I
want (header at the top, footer at the bottom, content centered).


> One of the
> issues I had with reveal last time I played with it was that my
> presentations looked different depending on which browser and/or display
> I used.  There was too much uncertainty in what I would actually get.
>
> But reveal and similar approaches are appealing for their simplicity.
I guess that's the downside of using html. Every render engine has a
certain amount of degrees of freedom on how they can render a html
construct. To tackle that problem my idea was, as a first step, to
produce slides based on reveal.js. That way I can use features, that
might be handy when it comes to teaching stuff. And maybe (I don't have
numbers etc., so I can be totally wrong) it is more likely to have a
more or less decent web browser at hand than a pdf viewer, esp. when it
comes to mobile devices.

As a second step, I wanted to use decktape to generate a pdf file from
the html based slides. That gives me a format with a more reproducible
layout (assuming that the render engine in decktape generates the same
output for subsequent runs).

Regards
hmw

PS: I opened a bug report for org-reveal, asking for an approach to
tackel to my issue. Maybe someone is so kind and points me in the
right direction ;).



Re: [O] org-reveal: content side by side

2018-02-11 Thread Michael Welle
Hello,

I just wanted to tell you how my adventure in reveal land ended ;).
Well, I spent a couple of hours last week and the better part of this
weekend with css. I could produce a slide similar to [0]. I couldn't
solve the structure problem I described earlier. And what put me off
in the end is, that I wasn't able to produce a slide like the one in [1]. 

Looks easy, eh? A header at the top, a footer at the bottom and a lot
of space in between. In some cases, like in [1], I wanted content (e.g.
Ich...OS/2 Warp 4) to be centered horizontally and
vertically between the footer and the header. 

Maybe it's my lack of understanding of css (I set colored borders for
every element and used the browser's web inspector tool to figure out
what happened.), maybe the css must be rewritten using flex layout, I
don't know. Until I will get bored again, I will stick with Org's beamer
export :)[2]. But anyways, if you want to share your experience with
ox-reveal, you are welcome.

Regards
hmw


[0] https://www.c0t0d0s0.de/tmp/vm1.png
[1] https://www.c0t0d0s0.de/tmp/vm2.png
[2] One last trick I want to try: Instead of switching reveal-center off
and marking the content that should be centered, I could go the
other way around: switching reveal-center on and trying to nail
content like the header at the top of the slide.




Re: [O] "clocktable" for efforts

2018-02-09 Thread Michael Welle
Hello,

Piotr Isajew  writes:

> Hi,
>
> I wonder if it's possible to have something like a clocktable, but
> based on effort, not the clocked time. My use case is that at the
> beginning of the project, when the effort for each of tasks is
> estimated, but none has been worked on yet, I need to generate
> some reports (preferably with tag filters) to show the aggregated
> effort for parts of the project.
does this stripped-down example help?

##
#+LINK_UP: index.html
#+LINK_HOME: ../index.html
#+TITLE: BIRD
#+COLUMNS: %50ITEM(Task) %Effort(Estimated){:} %CLOCKSUM(Clocked) %5TODO(State)

* Effort
#+BEGIN: columnview :hlines 2 :id "756fcb74-2e46-4757-82b8-461ed30a5f11"
| Task| Estimated | Clocked | 
State |
|-+---+-+---|
| User Stories| 54:00 |1:24 |   
|
|-+---+-+---|
| UI  |48 |1:24 | 
DONE  |
| Remove Company, Street, Place, Country again|   |1:24 | 
DONE  |
|-+---+-+---|
| Check preconditions | 6 | |   
|
| Check hw preconditions: hard disk, core memory, etc |   | | 
DONE  |
#+END:

* User Stories
  :PROPERTIES:
  :ID:   756fcb74-2e46-4757-82b8-461ed30a5f11
  :END:
  
** DONE UI [11/11]
   :PROPERTIES:
   :Effort:   48
   :END:

The user wants to have a familiar UI. Should look like ,
etc. The user wants to be entertained within his or her monkey time.

[2012-06-25 Mon] Extended: Show every parameter on its own page.

*** DONE Remove Company, Street, Place, Country again
- State "DONE"   from "OPEN"   [2012-07-17 Tue 09:51]
- State "OPEN"   from "TODO"   [2012-07-17 Tue 08:27]
CLOCK: [2012-07-17 Tue 08:27]--[2012-07-17 Tue 09:51] =>  1:24
[2012-07-16 Mon]

- Am [2012-07-16 Mon] so mit xx besprochen

** Check preconditions [4/4]
   :PROPERTIES:
   :Effort:   6
   :END:

The admin wants only certain user classes in certain circumstances to
be allowed to trigger reinstallations. The admin wants the user to
migrate only clients, that she is logged in into. If the
reinstallation is not allowed, inform the user in an approbiate way
and abort. 

- Check dispersion of load
- Check user class (FF, XX, TT, etc) if allowed to reinstall
- Check if computer is allowed for reinstall 

*** DONE Check hw preconditions: hard disk, core memory, etc
- State "DONE"   from "TODO"   [2012-07-17 Tue 09:21]
[2012-07-09 Mon]

- Escript periodically retrieves values on client and sets computer property
- user.ps1 check computer property

##

Regards
hmw



Re: [O] org-reveal: content side by side

2018-02-07 Thread Michael Welle
Hello,

Matt Price  writes:

> for this issue, I define a class "paired" in my local cass file (or
> actually, I now use a very modestly edited custom theme) :
>
>
> .paired {
> float:left !important;
> max-width:47% !important;
>
> }
>
> and then in the org file:
> :#+ATTR_HTML: :class paired
>
> That works OK for me. the "!important" is necessary because reveal css is
> prtty greedy & hard to override.
thanks, I will check it out. I have to say it takes quite some time to
get a presentation that looks as good as the beamer based presentation I
use as an example.

The current issue I have is this. I have a structure like this:

* foo
** foo1
** foo2

Basically foo acts as a container for the content. I want foo to appear
in the table of contents and I want two slides, foo1 and foo2, and none
for foo. I'm nearly there, but I don't know how to suppress the
generation of a slide for foo.

I could use this structure:

* foo1
* foo2

But I miss the container that groups the content for me, the presenter.
And what is more important, I don't know how to get foo into the TOC (in
a nice way).

Or I could use:

* foo1
** foo2

Which seems to have even more issues: the content of foo2 is on the same
level as the content of foo1, it's not sub-content. The headers of the
slides have different sizes then, etc.

Regards
hmw



Re: [O] org-reveal: content side by side

2018-02-04 Thread Michael Welle
Hello,

took me the better part of the afternoon, but I came up with the
following approach:



* Was ist Virtualisierung?
- Aus der Wikipedia:
#+BEGIN_QUOTE
Virtualisierung bezeichnet in der Informatik die Nachbildung eines
Hard- oder Software-Objekts durch ein ähnliches Objekt vom selben Typ
mit Hilfe eines Abstraktions-Layers.
#+END_QUOTE


#+REVEAL_HTML: 

#+REVEAL_HTML: 
[[./img/1290250232.svg]]
#+REVEAL_HTML: 

#+REVEAL_HTML: 
[[./img/Machovka-chip.svg]]
#+REVEAL_HTML: 

#+REVEAL_HTML: 
[[./img/SAN-Disk-Array-SCSI-29.07.11.svg]]
#+REVEAL_HTML: 

#+REVEAL_HTML: 


That resembles the slide from [0] to a certain degree. The three images
are centered, vertically and horizontally, even if they are of different
sizes. I'm not sure though how good the support for display:flex is,
esp. when it comes to mobile devices. And, for my taste at least, that
approach needs too much knowledge about style sheets. Still looking for
a nicer solution ;).

Regards
hmw

[0] https://www.c0t0d0s0.de/tmp/vm1.png



[O] org-reveal: content side by side

2018-02-04 Thread Michael Welle
Hello,

a new year, a new tool ;). I try to shift a bit away from beamer based
slides to a format, that allows me to create nice html-based slides and
nice pdf-based slides from the same source. It looks like org-reveal and
decktape might be what I want. Maybe. To find out I try to convert an
org-beamer based set of slides.

With the second slide first problems... revealed ;). How can I position
content, let's say images or images and text, side by side? Using
org-beamer I would do something like that: 

#+BEGIN_CENTER
#+ATTR_HTML: :width 25% :center
[[./img/1290250232.pdf]]
#+ATTR_HTML: :width 25% :center
[[./img/Machovka-chip.pdf]]
#+ATTR_HTML: :width 30% :center
[[./img/SAN-Disk-Array-SCSI-29.07.11.pdf]]
#+END_CENTER

That gives me three scaled images in a row (s. [0]).

That doesn't work with org-reveal. Putting the content into a table
works, kind of. But I don't know how to add the attributes used for
scaling, styles etc. And it will get complicated if I want to compose
the slide out of three or more blocks, e.g. something like that:

  aaa bbb
  aaa bbb
  ccc
  ccc

Any hints on that? I guess the question boils down
to how to produce a slide like the one in [0] with org-reveal.

Regards
hmw

[0] https://www.c0t0d0s0.de/tmp/vm1.png



Re: [O] Org Usenet

2018-01-04 Thread Michael Welle
Hello,

Eric S Fraga <esfli...@gmail.com> writes:

> On Thursday,  4 Jan 2018 at 15:48, Michael Welle wrote:
>> maybe because Lars considered shutting gmane down and transfered/sold it
>> to a company?
>
> Maybe but also possibly because the org site makes reference to the list
> but not to the newsgroup?  
>
> Might be good to point new users to the newsgroup as it is archived (on
> gwene) whereas the list no longer is (was on gmane).  Now I'm even
> confusing myself ;-)
having access to an archive is a good thing. On the other hand, I don't
make much use of the older postings in my own archive (about 65k
postings), maybe because Org changed so much over time.

Regards
hmw



Re: [O] Org Usenet

2018-01-04 Thread Michael Welle
Hello,

Eric S Fraga  writes:

> On Thursday,  4 Jan 2018 at 07:57, Dave Marquardt wrote:
>> What about gmane.emacs.orgmode?
>
>  
>
> yes, of course.  although I have that in my list of newsgroups, I have
> it turned off in preference to the mailing list.  Not sure why, mind
> you.
maybe because Lars considered shutting gmane down and transfered/sold it
to a company?

Regards
hmw



Re: [O] [IMPORTANT] Server migration: please update your git repositories before 31/12/2017

2017-12-28 Thread Michael Welle
Hello,

thank you all, who are involved in keeping Org going. Not only the
people, who provide infrastructure, but also the people, who do the daily
work, who provide patches and the people, who use Org.

Bastien Guerry  writes:

> Dear all,
>
> thanks to Jason Dunsmore, we were able to have our orgmode.org server
> sponsored by Rackspace.  Their OSS hosting program ends by the end of
> the year¹.  Thanks a lot to Rackspace for this program, it saved us a
> lot of money!  And to Jason for letting us know about it.
>
> I have configured a new server: a vultr.com Debian 9 x64 with 1024 MB
> at 5$ per month -- for a start.
Is there a way to throw a bit of money on the project, not using the
company behind the support button on the web page?

Regards
hmw



Re: [O] Referencing TODO items

2017-12-15 Thread Michael Welle
Hello,

Paulo Matos <pa...@matos-sorge.com> writes:

> On 14/12/17 17:57, Michael Welle wrote:
>> it is from org-id.
>
> Can't seem to find org-id on melpa or org mode contrib page.
> http://orgmode.org/worg/org-contrib/
>
> can you please point me to where i can find it?
org-id should be part of the org package as well as of the
org-plus-contrib package.

Regards
hmw



Re: [O] Referencing TODO items

2017-12-14 Thread Michael Welle
Hello,

Paulo Matos <pa...@matos-sorge.com> writes:

> On 14/12/17 15:20, Michael Welle wrote:
>>>
>>> I am curious why %hi and %lo would cause any troubles...
>> I can confirm that behaviour, but it doesn't bother me, because I use ;):
>> 
>> (setq org-id-link-to-org-use-id 'create-if-interactive)
>> 
>
> When I looked at it, it sounded that the only thing it does it to
> automatically create the heading without prompting, however I ran into
> troubles when testing. My org-mode doesn't have that variable (9.1.2)
it is from org-id. It gives the heading a unique id and uses that to
reference the heading instead of the heading's text. That way the
reference does not become invalid if the heading's text changes. And, as
a side effect, it works around the problem you found.


> and even if it did it wouldn't solve the problem (assuming I am correct
> about its intended behaviour since I don't want a new heading, I want to
> follow the link to the existing heading.
No, it doesn't solve the problem. I guess the problem is that the
heading's text is fed to a format form or something like that.

Regards
hmw



Re: [O] Referencing TODO items

2017-12-14 Thread Michael Welle
Hello,

Paulo Matos  writes:
[...]
> Interesting but it doesn't really work properly.
>
> My TODO looks like:
>
> * TODO add support for %lo and %hi operands in offsets
>
> I create the link and the link has the name of the todo headline.
> When I try to follow with C-c C-o, it says 'No match - create a new
> heading?'. If I say yes, a new heading is created in my document that
> looks like:
>
> * *add support for ^@ and ^@ operands in offsets
>
> I am curious why %hi and %lo would cause any troubles...
I can confirm that behaviour, but it doesn't bother me, because I use ;):

(setq org-id-link-to-org-use-id 'create-if-interactive)

Regards
hmw



Re: [O] Referencing TODO items

2017-12-14 Thread Michael Welle
Hello,

Paulo Matos  writes:

> Hi,
>
> I have a TODO item that got stuck due to some unforseen circumstances.
> Another TODO item is needed as a workaround therefore I have something like:
>
> * TODO Implement using hash tables
>   :LOGBOOK:
>   - Note taken on ... \\
>   Stuck because...
>   :END:
>
> * TODO Implement using hand written maps
>   This is required because todo item REF was stuck. If unstuck, we can
> remove this implementation.
>
> How can I REF the first TODO item in the second?
do M-x org-store-link on the first TODO item and M-x org-insert-link
where you want to reference the first TODO item.

Regards
hmw



Re: [O] Is it possible to pass variable to variables of src block?

2017-12-13 Thread Michael Welle
Hello,

Xi Shen  writes:

> Hi Michael,
>
> Yes, I think this is a way to my previous question. But what I really want
> to achieve is to loop through a list of server names and execute a script
> on them.
>
> Say I have 20 different database server. How can I do a loop with each
> server?
interestingly I did not found a good solution after a bit of thinking...
The best I could come up with is something like this (which doesn't work):


#+name: foosql
#+BEGIN_SRC sql :dbuser weather :database environment :engine postgresql
select time, temperature from weather limit 10;
#+END_SRC


#+begin_src emacs-lisp :results raw :var hosts=(list "db1" "db2" "db3")
(dolist (host hosts)
  (org-sbe foosql (concat ":dbhost " host)))
#+end_src

Error: Symbol's definition is void: host. I guess that's caused by the
way the macro is evaluated. And the result, if any, of the sql query had
to be transformed back into a nice table for some use cases.

Using other means of calling a code block, like #+call etc., aren't
suitable for usage in a loop. So maybe someone can come up with a nice
solution ;).

Regards
hmw



Re: [O] Is it possible to pass variable to variables of src block?

2017-12-06 Thread Michael Welle
Hello,

Xi Shen  writes:

> Hi,
>
> http://orgmode.org/manual/var.html
>
> This wiki explains how to use variable inside a src block. But I wonder if
> it is possible to specify variable to the variables in the src definition.
>
> E.g. for the sql src block, I want to execute a script on different server.
> I want to define a variable for the ":dbhost" variable.
did you think about something like this?


(setq hmw/dbhost "db1")

#+BEGIN_SRC sql :dbhost (symbol-value 'hmw/dbhost) :dbuser weather :database 
environment :engine postgresql
select time, temperature from weather limit 20;
#+END_SRC

Regards
hmw



Re: [O] ob-shell and remote shells

2017-11-28 Thread Michael Welle
Hello,


"numbch...@gmail.com"  writes:

> Off the topic, I'm curious what is the `:session` in `ob-shell` ?
it basically means that state is preserved for code blocks that run in
the same session (as long as the interpreter is running). Or in other
words, imagine two code blocks: the first sets a variable, the second
prints the variable. Without sessions the code blocks run in different
shell instances and the second block doesn't 'see' the variable set by
the first code block. But if both run in the same session, the second
code block 'sees' the state left by the first code block.

Regard
hmw



Re: [O] ob-shell, output and continuation prompts

2017-11-28 Thread Michael Welle
Hello,

Michael Welle <mwe012...@gmx.net> writes:

> Hello Eric,
>
> Eric S Fraga <esfli...@gmail.com> writes:
>
>> On Tuesday, 28 Nov 2017 at 13:23, Michael Welle wrote:
>>> I think that last one is what one would expect ;). Anyways, using sessions,
>>> is there a way to get rid off of the shell's continuation prompts?
>>
>> PS2=""
>>
>> in the shell script?
> does that work for you? I had to evaluate
> (add-to-list 'tramp-remote-process-environment "PS2=> "). Otherwise
> tramp/emacs would wait forever after sending the first line of the for
> loop. 

oh, I should add that. Albeit the example I posted earlier runs locally,
my goal is to execute the shell code on a remote machine. But the
result is the same with both scenarios.

#+BEGIN_SRC shell :session n42 :dir /localhost: :shebang "#!/bin/bash"
for i in "aa" "bb" "cc" ; do
echo "u: $i"
done
#+end_src

Regards
hmw



Re: [O] ob-shell, output and continuation prompts

2017-11-28 Thread Michael Welle
Hello Eric,

Eric S Fraga <esfli...@gmail.com> writes:

> On Tuesday, 28 Nov 2017 at 13:23, Michael Welle wrote:
>> I think that last one is what one would expect ;). Anyways, using sessions,
>> is there a way to get rid off of the shell's continuation prompts?
>
> PS2=""
>
> in the shell script?
does that work for you? I had to evaluate
(add-to-list 'tramp-remote-process-environment "PS2=> "). Otherwise
tramp/emacs would wait forever after sending the first line of the for
loop. 

Regards
hmw



[O] ob-shell, output and continuation prompts

2017-11-28 Thread Michael Welle
Hello,

this code block:

#+BEGIN_SRC shell :session n42 :shebang "#!/bin/bash"
for i in "aa" "bb" "cc" ; do
echo "u: $i"
done
#+end_src

produces this output when it first runs:

#+RESULTS:
|||||
| >  | >  | u: | aa |
| u: | bb |||
| u: | cc |||


After the first run, subsequent runs produce this output:

#+RESULTS:
||||
| >  | u: | aa |
| u: | bb ||
| u: | cc ||

If I set :session to none the output is always like follows:

#+RESULTS:
| u: | aa |
| u: | bb |
| u: | cc |


I think that last one is what one would expect ;). Anyways, using sessions,
is there a way to get rid off of the shell's continuation prompts?

Regards
hmw



[O] ob-shell and remote shells

2017-11-28 Thread Michael Welle
Hello,

I want to execute shell blocks like follows:

#+BEGIN_SRC shell :session n42 :dir /127.0.0.1: :shebang "#!/bin/bash"
echo los
echo $SHELL
echo $BASH
echo ready
#+end_src

The trouble is that the shebang property doesn't work in this case. The
script is executed with the login shell of the user and fails because of
syntax errors (for instance, if bashisms are used in the script).

With my minimal and dangerous knowledge about Org's source code ;), I
think the following might work (from ob-shell.el):

(defun org-babel-sh-initiate-session ( session _params)
  "Initiate a session named SESSION according to PARAMS."
  (when (and session (not (string= session "none")))
(save-window-excursion
  (or (org-babel-comint-buffer-livep session)
  (progn
(let ((explicit-shell-file-name (xxx)))
(shell session))
;; Needed for Emacs 23 since the marker is initially
;; undefined and the filter functions try to use it without
;; checking.
(set-marker comint-last-output-start (point))
(get-buffer (current-buffer)))


Note the let form. Further tasks that have to be done is to add the
shebang key to _params, which I hope is available at all places where
o-b-s-i-s is evaluated. Further at (xxx) a regexp etc. is needed to
transform the shebang line to a shell path suitable for e-s-f-n.

Any opinions, please? Depending on the opinions I will implement the
approach this week and see if it works as expected.

Regards
hmw



Re: [O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

Joon Ro  writes:

>> 2.  Write a function to look up the tree from point and export the first
>> subtree with a certain property.
> I thought about implementing the second approach. I have slides for
> several talks in the same org file. Since I mostly need this
> functionality when I'm developing slides, just going up from point until
> reaching the desired heading is easy to implement.
>
> If you can implement this, that would be great as I find myself doing
> this all the time as well.
I use this ad hoc implementation:


(defun hmw/org-export ( level)
  "Go up to a section of level `level', if there is any, and then call 
`org-export-dispatch'. `level' defaults to 1."
  (interactive)
  (unless level (setq level 1))
  (save-excursion
  (while (< level (or (org-up-heading-safe) -1)))
  (if (org-at-heading-p)
  (org-export-dispatch


That hack could be optimised, but works for me ;).


Regards
hmw



Re: [O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

Adam Porter <a...@alphapapa.net> writes:

> Michael Welle <mwe012...@gmx.net> writes:
>
>> Is there an existing way to say that I want to go up to a level n
>> heading and then export, or do I have to implement that by myself?
>
> I think you'll have to do it yourself.  Here are a couple of ideas:
>
> 1.  Write a function to export a subtree with a specific Org ID.
>
> 2.  Write a function to look up the tree from point and export the first
> subtree with a certain property.
I thought about implementing the second approach. I have slides for
several talks in the same org file. Since I mostly need this
functionality when I'm developing slides, just going up from point until
reaching the desired heading is easy to implement. 

Regards
hmw



Re: [O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Hello,
>
> Michael Welle <mwe012...@gmx.net> writes:
>
>> imagine the following document structure:
>>
>> * talk1
>> * talk2
>> ** foo
>> ** bar
>> ** foobaz
>>
>>
>> Now the point is in section foobaz and I want to export the subtree
>> talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
>> up to * talk2, export the subtree and then move the point back.
>
> Note that subsequent C-u C-c C-e will re-use the same subtree.
ah, learned something new here.


>> Is there an existing way to say that I want to go up to a level n
>> heading and then export, or do I have to implement that by myself?
>
> The latter, if you want to have this right from the start (and not from
> the second call)
I think, I will stick with this, because even if I use C-u C-c C-e I
will forget to move up to the right heading the first time I use it ;).

Regards
hmw



[O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

imagine the following document structure:

* talk1
* talk2
** foo
** bar
** foobaz


Now the point is in section foobaz and I want to export the subtree
talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
up to * talk2, export the subtree and then move the point back.

Is there an existing way to say that I want to go up to a level n
heading and then export, or do I have to implement that by myself?

Regards
hmw



Re: [O] Tracking Interruptions -- Work Flow Question

2017-08-13 Thread Michael Welle
Hello,

Eric Abrahamsen  writes:

> Raymond Zeitler  writes:
>
>> Does anyone schedule and "org-clock" interruptions? I really need to
>> quantify how much of a drain they are to my productivity.
>>
>> I thought I'd include a generic "** TODO Interruption" in my
>> todo.org (or an inter.org file) and schedule it every day. Then I'd
>> press "I" every time I get interrupted and perhaps tag it with a
>> special term.
>>
>> Or I suppose I could use a capture template just for interruptions.
>>
>> What do you suggest?
>
> Seems to me the danger of interruptions is not how much time they take
> up, but how much time it takes you to recover from them, and get back to
> work. Much harder to clock!
yepp. Maybe add a 'braininess' factor to every task. Tasks, that need a
lot of thinking, let's say hacking, have a higher 'braininess' than, for
instance, sharpening pencils. Depending on the 'braininess' of the
interrupted task add another 15 or 30 minutes to the interruption
account. 

Regards
hmw



Re: [O] stable org-plus-contrib

2017-05-14 Thread Michael Welle
Hello,

Kaushal Modi  writes:
[...]
> Well, most of the times, I just report them. The org dev community is very
> active and a reported bug usually gets fixed in a day or two.
yes, that's true. The 'core developers' and all the others, developers
as well as users, do an amazing job and invest a lot of time in Org. I
often take that for granted and forget to thank them. So, thank you for
making my life better with Org ;).

Regards
hmw



Re: [O] function-finding-location?

2017-04-23 Thread Michael Welle
Hello,

Xebar Saram  writes:

> today i saw this in the DOCU
>
> (file+function "path/to/file" function-finding-location)
> A function to find the right location in the file.
>
> i assume you dont just use "function-finding-location" but rather a
> specific function. are there examples for such functions?
something like this would do the trick:

(defun hmw/foo ()
  (goto-char (org-find-exact-headline-in-buffer "boingfoo")))

You can, of course, use regexp or other means of finding the position in
the file.

Does that help?

Regards
hmw




Re: [O] Plone?

2017-04-10 Thread Michael Welle
Hello,

Roland Everaert  writes:

> Maybe you can have a look at this page:
>
> https://docs.plone.org/about/helper_tools.html
hm, aren't that all specialised editors for ReStructuredText? Now that I
have an rst file, I fail to import it into the CMS ;(. But that's more
of a question for the plone people, I guess.

Regards
hmw



[O] Plone?

2017-04-10 Thread Michael Welle
Hello,

it happens to me that I now have to use a CMS named plone to document
things I do ;). Has anyone tried to export to plone? Or wants to share
experiences? 

I can use standard html export, change the id of the content div and c
that to the plone content editor. That works OKish. But it would be
nice, if, for instance, the sections of the Org file would occur in
plone's navigation (without too much manual labour of course ;)).

Regards
hmw



Re: [O] Creating consecutive time stamps

2017-04-04 Thread Michael Welle
Hello Carsten,

Carsten Dominik  writes:

> Hi MIchael,
>
> the automatic reset of the starting date for a second time stamp on works
> if the command `org-time-stamp' is invoked twice in direct succession.  So
> if you press `C-c  .'  to insert a time stamp, and then you press it
> immediately again, the magic will take its course.  This is probably the
> situation that you remember.
ah, suddenly all makes sense ;). I changed the template a couple of
years ago. It could well be that I inserted both time stamps vie C-c.
before the change.


> However, if you use %T in a template, then `last-command' is `org-capture',
> and the time stamp command does not know that you are making a range.  I
> could, by looking back and finding <...>-- , but that is not implemented.
> You might be better off Using an empty template and then inserting both
> time stamps with `C-c .' - which will make it easy to also directly choose
> the starting date.
Yes, that's way faster than navigation the calendar two times, esp. if
the appointment is far in the future.

Thank you
hmw



[O] Creating consecutive time stamps

2017-04-04 Thread Michael Welle
Hello,

the subject is a bit fuzzy, so let me depict an example use case:
creating an appointment for a multi-day conference. I use a capture
template with the placeholder %T for that (I use the same template for
single day appts, which occur more often.). Then I adjust the inserted
time stamp, add --, press C-. and add the second time stamp.

So far, good. The itching point is that the calendar view for the second
time stamp starts today, again, not at the date of the first time stamp.
I can dimly remember -or I think I do ;)- that that was different in the
past, maybe with a different template. Any ideas for a 'grey ointment'
that stops the itching?

Regards
hmw



Re: [O] org-bbdb-anniversaries-future

2017-03-13 Thread Michael Welle
Hello,

oops, I think the double space after full stop rule applies here, too.
Sorry for the noise.


Michael Welle <mwe012...@gmx.net> writes:
[...]
>> Could you provide an ORG-NEWS entry for the feature?
>
>
*** More specific anniversary descriptions

Anniversary descriptions (used in the agenda view, for instance)
include the point in time, when the anniversary appears.  This is,
in its most general form, just the date of the anniversary.  Or
more specific terms, like "today", "tomorrow" or "in n days" are
used to describe the time span.

This feature allows to automatically change the description of an
anniversary, depending on if it occurs in the next few days or
far away in the future.


Regards
hmw



Re: [O] org-bbdb-anniversaries-future

2017-03-13 Thread Michael Welle
Hello,

Nicolas Goaziou wrote:
> 
> Hello,
> 
> Michael Welle <mwe012...@gmx.net> writes:
> 
> > thank you for the valuable comments. I think I've incorporated them all.
> > Furthermore I reworded some of the comments and I introduced a defvar,
> > so that the point in time, when to switch to the more general
> > descriptive text isn't hardcoded anymore, but customisable.
> 
> I applied your patch. Thank you.
thank you. I think that makes at least three people, including me,
happy ;).


> I added :version, :package-version and :safe keywords in the defcustom.
> I sligthly reworded the docstring so as to avoid documenting recursively
> the variable.
> 
> Could you provide an ORG-NEWS entry for the feature?


*** More specific anniversary descriptions

Anniversary descriptions (used in the agenda view, for instance)
include the point in time, when the anniversary appears. This is,
in its most general form, just the date of the anniversary. Or
more specific terms, like "today", "tomorrow" or "in n days" are
used to describe the time span.

This feature allows to automatically change the description of an
anniversary, depending on if it occurs in the next few days or
far away in the future.


Regards
hmw



Re: [O] org-bbdb-anniversaries-future

2017-03-07 Thread Michael Welle
Hello,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Hello,
>
> Michael Welle <mwe012...@gmx.net> writes:
>
>> Maybe it's a tiny change, if we strip the comments ;). It's not too
>> sophisticated, everyone could have done it.
>
> I definitely think it _is_ a tiny change.
>
> Some comments follow.
thank you for the valuable comments. I think I've incorporated them all.
Furthermore I reworded some of the comments and I introduced a defvar,
so that the point in time, when to switch to the more general
descriptive text isn't hardcoded anymore, but customisable. 


> Also, could you provide a commit message?

Make anniversaries' time span information more descriptive in agenda.

* lisp/org-bbdb.el (org-bbdb-anniversary-description): New function.
(org-bbdb-general-anniversary-description-after): New variable.
(org-bbdb-anniversaries-future): Incorporate calculation of the description.


Regards
hmw

diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el
index f851668..0aa1ddb 100644
--- a/lisp/org-bbdb.el
+++ b/lisp/org-bbdb.el
@@ -138,6 +138,19 @@
   :group 'org-bbdb-anniversaries
   :require 'bbdb)
 
+(defcustom org-bbdb-general-anniversary-description-after 7
+  "When to switch anniversary descriptions to a more general format.
+Anniversary descriptions include the point in time, when the
+anniversary appears.  This is, in its most general form, just the
+date of the anniversary.  Or more specific terms, like 'today',
+'tomorrow' or 'in n days' are used to describe the time span.  If
+the anniversary is ORG-BBDB-GENERAL-ANNIVERSARY-DESCRIPTION-AFTER
+or more days in the future, the general description is used,
+otherwise the more specific description is used."
+  :type  'integer
+  :group 'org-bbdb-anniversaries
+  :require 'bbdb)
+
 (defcustom org-bbdb-anniversary-format-alist
   '(("birthday" .
  (lambda (name years suffix)
@@ -412,7 +425,25 @@ This is used by Org to re-create the anniversary hash table."
 (mapcar (lambda (i) (calendar-gregorian-from-absolute (+ abs i)))
 	(number-sequence 0 (1- n)
 
-;;;###autoload
+(defun org-bbdb-anniversary-description (agenda-date anniv-date)
+  "Return a string used to incorporate into an agenda anniversary entry.
+The calculation of the anniversary description string is based on
+the difference between the anniversary date, given as ANNIV-DATE,
+and the date on which the entry appears in the agenda, given as
+AGENDA-DATE.  This makes it possible to have different entries
+for the same event depending on if it occurs in the next few days
+or far away in the future."
+  (let ((delta (- (calendar-absolute-from-gregorian anniv-date)
+  (calendar-absolute-from-gregorian agenda-date
+
+(cond
+ ((= delta 0) " -- today\\&")
+ ((= delta 1) " -- tomorrow\\&")
+ ((< delta org-bbdb-general-anniversary-description-after) (format " -- in %d days\\&" delta))
+ ((pcase-let ((`(,month ,day ,year) anniv-date))
+	(format " -- %d-%02d-%02d\\&" year month day))
+
+
 (defun org-bbdb-anniversaries-future ( n)
   "Return list of anniversaries for today and the next n-1 days (default n=7)."
   (let ((n (or n 7)))
@@ -425,19 +456,17 @@ must be positive"))
 	  ;; Function to annotate text of each element of l with the
 	  ;; anniversary date d.
 	  (annotate-descriptions
-	   (lambda (d l)
+	   (lambda (agenda-date d l)
 	 (mapcar (lambda (x)
 		   ;; The assumption here is that x is a bbdb link
 		   ;; of the form [[bbdb:name][description]].
 		   ;; This function rather arbitrarily modifies
 		   ;; the description by adding the date to it in
 		   ;; a fixed format.
-		   (string-match "]]" x)
-		   (replace-match (format " -- %d-%02d-%02d\\&"
-	  (nth 2 d)
-	  (nth 0 d)
-	  (nth 1 d))
-  nil nil x))
+		   (let ((desc (org-bbdb-anniversary-description
+agenda-date d)))
+			 (string-match "]]" x)
+			 (replace-match desc nil nil x)))
 		 l
   ;; Map a function that generates anniversaries for each date
   ;; over the dates and nconc the results into a single list. When
@@ -447,12 +476,13 @@ must be positive"))
   (apply #'nconc
 	 (mapcar
 	  (lambda (d)
-		(let ((date d))
+		(let ((agenda-date date)
+		  (date d))
 		  ;; Rebind 'date' so that org-bbdb-anniversaries will
 		  ;; be fooled into giving us the list for the given
 		  ;; date and then annotate the descriptions for that
 		  ;; date.
-		  (funcall annotate-descriptions d (org-bbdb-anniversaries
+		  (funcall annotate-descriptions agenda-date d (org-bbdb-anniversaries
 	  dates)
 
 (defun org-bbdb-complete-link ()


Re: [O] org-bbdb-anniversaries-future

2017-03-01 Thread Michael Welle
Hello,

Alan Schmitt <alan.schm...@polytechnique.org> writes:

> On 2017-03-01 15:03, Michael Welle <mwe012...@gmx.net> writes:
>
>>> I don't think it helps. IIRC, code integration in Emacs is pretty
>>> strict. You could simply sign FSF papers.
>> Yes. Trouble is nobody could explain to me what I have to sign and what
>> that means in the legal system I'm in. My last attempt to find that out
>> was in #emacs. It's about 'transfer of copyright' to the FSF. If I
>> translate 'copyright' to the corresponding construct in our legal
>> system, the transfer isn't possible. I can't give away the copyright.
>> Maybe 'transfer of copyright' isn't what signing the FSF papers mean, I
>> don't know. And IANAL ;).
>
> Does the FSFE version works for emacs
> (https://fsfe.org/activities/ftf/fla.en.html)?
good question, I don't know the answer... yet.

Regards
hmw



Re: [O] org-bbdb-anniversaries-future

2017-03-01 Thread Michael Welle
Hello,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Hello,
>
> Michael Welle <mwe012...@gmx.net> writes:
>
>> Even if we assume its quality is high enough to integrate it into Org,
>
> If code quality was a concern, Org would still be in alpha release ;)
thank you for your kind words, Nicolas ;).


>> there might or might not be another problem: I haven't signed the FSF
>> papers. I would like to see the functionality in Org, too. Perhaps
>> someone can sneak it in ;). I can repost the code, stating that it is
>> licensed under the GPL or is even in the public domain, if that helps.
>
> I don't think it helps. IIRC, code integration in Emacs is pretty
> strict. You could simply sign FSF papers.
Yes. Trouble is nobody could explain to me what I have to sign and what
that means in the legal system I'm in. My last attempt to find that out
was in #emacs. It's about 'transfer of copyright' to the FSF. If I
translate 'copyright' to the corresponding construct in our legal
system, the transfer isn't possible. I can't give away the copyright.
Maybe 'transfer of copyright' isn't what signing the FSF papers mean, I
don't know. And IANAL ;).

> Otherwise, doesn't it fit as a tiny change? Would you mind sending the
> patch again?
Maybe it's a tiny change, if we strip the comments ;). It's not too
sophisticated, everyone could have done it.

Regards
hmw

diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el
index f851668..5e99494 100644
--- a/lisp/org-bbdb.el
+++ b/lisp/org-bbdb.el
@@ -412,6 +412,22 @@ This is used by Org to re-create the anniversary hash table."
 (mapcar (lambda (i) (calendar-gregorian-from-absolute (+ abs i)))
 	(number-sequence 0 (1- n)
 
+(defun org-bbdb-anniversary-description (agenda-date anniv-date)
+  "Return a string used to modify an agenda anniversary entry. The 
+   calculation of the string is based on the difference between
+   the anniversary date and the date on which the entry appears
+   in the agenda. This makes it possible to have different entries
+   for the same event depending on if it occurs in the next few days
+   or far away in the future."
+  (let ((delta (- (calendar-absolute-from-gregorian anniv-date)
+  (calendar-absolute-from-gregorian agenda-date
+
+(cond
+ ((= delta 0) " -- today\\&")
+ ((= delta 1) " -- tomorrow\\&")
+ ((< delta 7) (format " -- in %d days\\&" delta))
+ ((format " -- %d-%02d-%02d\\&" (third anniv-date) (first anniv-date) (second anniv-date))
+
 ;;;###autoload
 (defun org-bbdb-anniversaries-future ( n)
   "Return list of anniversaries for today and the next n-1 days (default n=7)."
@@ -425,19 +441,17 @@ must be positive"))
 	  ;; Function to annotate text of each element of l with the
 	  ;; anniversary date d.
 	  (annotate-descriptions
-	   (lambda (d l)
+	   (lambda (agenda-date d l)
 	 (mapcar (lambda (x)
 		   ;; The assumption here is that x is a bbdb link
 		   ;; of the form [[bbdb:name][description]].
 		   ;; This function rather arbitrarily modifies
 		   ;; the description by adding the date to it in
 		   ;; a fixed format.
-		   (string-match "]]" x)
-		   (replace-match (format " -- %d-%02d-%02d\\&"
-	  (nth 2 d)
-	  (nth 0 d)
-	  (nth 1 d))
-  nil nil x))
+		   (let ((desc (org-bbdb-anniversary-description
+agenda-date d)))
+			 (string-match "]]" x)
+			 (replace-match desc nil nil x)))
 		 l
   ;; Map a function that generates anniversaries for each date
   ;; over the dates and nconc the results into a single list. When
@@ -447,12 +461,13 @@ must be positive"))
   (apply #'nconc
 	 (mapcar
 	  (lambda (d)
-		(let ((date d))
+		(let ((agenda-date date)
+		  (date d))
 		  ;; Rebind 'date' so that org-bbdb-anniversaries will
 		  ;; be fooled into giving us the list for the given
 		  ;; date and then annotate the descriptions for that
 		  ;; date.
-		  (funcall annotate-descriptions d (org-bbdb-anniversaries
+		  (funcall annotate-descriptions agenda-date d (org-bbdb-anniversaries
 	  dates)
 
 (defun org-bbdb-complete-link ()


Re: [O] org-bbdb-anniversaries-future

2017-03-01 Thread Michael Welle
Hello,

Alan Schmitt  writes:
[...]
> Sorry for reviving this old thread, but was this added to org? I would
> find it most useful.
no, it's not.

Even if we assume its quality is high enough to integrate it into Org,
there might or might not be another problem: I haven't signed the FSF
papers. I would like to see the functionality in Org, too. Perhaps
someone can sneak it in ;). I can repost the code, stating that it is
licensed under the GPL or is even in the public domain, if that helps.

Regards
hmw



[O] org-caldav, pull only

2017-02-19 Thread Michael Welle
Hello,

can I configure org-caldav in such a way, that it doesn't synchronise,
but only pull from the server? I don't want local changes, esp.
deletions in shared calendars, going back to the server.

Regards
hmw



Re: [O] org-faq page on Worg seems busted

2017-01-27 Thread Michael Welle
Hello,

Michael Welle <mwe012...@gmx.net> writes:

> Hello,
>
> Nick Dokos <ndo...@gmail.com> writes:
> [...]
>> that, but publishing locally fails at a couple of [[id:][foo]] links:
>>
>>Unable to resolve link: "id:facac2a6-3526-450d-ac42-8d36b16c6bab"
>>
>> What's up with that?
> hm, I dimly remember having that (or a similar) problem. (require 'org-id)
> fixed that for me.
if the link target exists, of course.

Regards
hmw



Re: [O] org-faq page on Worg seems busted

2017-01-27 Thread Michael Welle
Hello,

Nick Dokos  writes:
[...]
> that, but publishing locally fails at a couple of [[id:][foo]] links:
>
>Unable to resolve link: "id:facac2a6-3526-450d-ac42-8d36b16c6bab"
>
> What's up with that?
hm, I dimly remember having that (or a similar) problem. (require 'org-id)
fixed that for me.

Regards
hmw



Re: [O] Temporary cancelling recurring tasks

2017-01-26 Thread Michael Welle
Hello,

Mikhail Skorzhinskiy  writes:

> Take a look to 
> http://karl-voit.at/2017/01/15/org-clone-subtree-with-time-shift/
someone (you ;)?) in #emacs suggested that, too. But I don't understand
how that would help. Can you explain, please?

I understand the problem Karl wants to solve, I myself have the same
problem from time to time. But to be honest, I don't think copying the
same task over and over again is a solution to that problem.

Regards
hmw



Re: [O] Temporary cancelling recurring tasks

2017-01-26 Thread Michael Welle
Hello,

Nick Dokos <ndo...@gmail.com> writes:

> Michael Welle <mwe012...@gmx.net> writes:
>
>> Hello,
>>
>> I want to temporary cancel recurring tasks. Let's say I have tasks, that
>> only make sense when I'm in my office. Now I'm away for a few months.
>> The tasks would clutter my agenda. I could comment them, archive them or
>> use org-cancel-repeater and set the task's state to DONE. But all that
>> makes it hard to restore the previous state when I'm back in my office.
>>
>> I think, the clean solution is to set the state of the task to CANCELLED
>> or STOPPED or something like that, to deactivate the recurring task.
>> When I activate the task again, the scheduled date and the repeater
>> should be restored. To achieve that, I tried the following:
>>
>
> Can't you just reschedule them for after you get back?
that means that I need to know in advance when I'm back.

Regards
hmw



[O] Temporary cancelling recurring tasks

2017-01-26 Thread Michael Welle
Hello,

I want to temporary cancel recurring tasks. Let's say I have tasks, that
only make sense when I'm in my office. Now I'm away for a few months.
The tasks would clutter my agenda. I could comment them, archive them or
use org-cancel-repeater and set the task's state to DONE. But all that
makes it hard to restore the previous state when I'm back in my office.

I think, the clean solution is to set the state of the task to CANCELLED
or STOPPED or something like that, to deactivate the recurring task.
When I activate the task again, the scheduled date and the repeater
should be restored. To achieve that, I tried the following:


;;
;; Deactivate/Activate recurring tasks
;;


;; Prior to Org commit 7d52a8c3cc86c8ce03eda006752af1ab4bed4316
;; there seems to be no way to set the repeater of a, let's say,
;; SCHEDULED property programmatically. So we use this function.
(defun hmw/org-schedule-set-value (val)
  "Sets the value of the SCHEDULED property. This allows for
setting the repeater as well."
  (interactive)
  (save-excursion
(org-back-to-heading t)
(let ((bound1 (point))
  (bound0 (save-excursion (outline-next-heading) (point
  (when (re-search-forward
 (concat "\\(" org-scheduled-time-regexp "\\)")
 bound0 t)
(replace-match val t nil nil 2)

(defvar hmw/org-scheduled-property-backup "DISABLED-SCHEDULED"
  "Back up the original value of the SCHEDULED property into this
property when deactivating a recurring task. The value is rescued from
this property to initialise the SCHEDULED property when activating the
task again.")

(defvar hmw/org-activated-recurring-task-state "TODO"
  "Switch a recurring task to this state after activating.")

(defvar hmw/org-deactivated-recurring-task-state "CANCELLED"
  "Switch a recurring task to this state after deactivating.")

(defun hmw/org-deactivate-recurring-task ()
  "Deactivate a recurring task. The value of the SCHEDULED property is
stored in the property referenced by `hmw/org-scheduled-property-backup',
so it can be restored later. The task's state is set to the value of
`hmw/org-deactivated-recurring-task-state'." 
  (interactive)
  (when (org-entry-is-todo-p)
(save-excursion
  (org-back-to-heading t)
  (let* ((pom (point-at-bol))
 (val (org-entry-get pom "SCHEDULED")))
(when val
  ;; Remove the time stamp meaning. We don't want active
  ;; timestamp to trigger any actions for the deactivated
  ;; task.
  (setq val (replace-regexp-in-string "^<\\(.*\\)>$" "\\1" val))
  (org-entry-put pom hmw/org-scheduled-property-backup val)
  (org-entry-put pom "SCHEDULED" nil)
  (org-todo hmw/org-deactivated-recurring-task-state))

(defun hmw/org-activate-recurring-task ()
  "Activate a previously deactivated recurring task. The value of the
SCHEDULED property is retrieved from the property referenced by
`hmw/org-scheduled-property-backup', which is then deleted. The task's 
state is set to the value of `hmw/org-activated-recurring-task-state'."
  (interactive)
  (when (org-entry-is-done-p)
(save-excursion
  (org-back-to-heading t)
  (let* ((pom (point-at-bol))
 (val (org-entry-get pom hmw/org-scheduled-property-backup)))
(when val
  ;; For Org commit 7d52a8c3cc86c8ce03eda006752af1ab4bed4316 or
  ;; later use this
  ;;(setq val (replace-regexp-in-string "^\\(.*\\)$" "<\\1>" val))
  ;;(org-entry-put pom "SCHEDULED" val)
  
  ;; For older Org use this
  (org-entry-put pom "SCHEDULED" val)
  (hmw/org-schedule-set-value val)
  
  (org-entry-delete pom hmw/org-scheduled-property-backup)
  (org-todo hmw/org-activated-recurring-task-state))
 

The idea is to store the value of the SCHEDULED property somewhere when
the task gets deactivated. Later, on activation, the property value is
restored.

There are two variants. The one above, which should work for Org prior
to commit 7d52a8c3cc86c8ce03eda006752af1ab4bed4316 and also for later
revisions. And one for that commit and later. If you use the newer Org
revision, you optionally can get rid of the function
hw/org-schedule-set-value and follow the comments in
hmw/org-activate-recurring-task.

Regards
hmw



Re: [O] How to set the scheduled property programmatically?

2017-01-26 Thread Michael Welle
Hello,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Hello,
>
> Michael Welle <mwe012...@gmx.net> writes:
>
>> what is the correct way to set the property? I tried
>>
>> (org-entry-put pom "SCHEDULED" "<2017-01-01 Sun ++1w>")
>>
>> which results in
>>
>> SCHEDULED: <2017-01-01 Sun>
>>
>> As you can see, the 'repeater' is missing.
>
> Fixed. Thank you.
thank you, that's much appreciated.

Regards
hmw



Re: [O] Table formula from code block

2017-01-25 Thread Michael Welle
Hello,

Eric S Fraga <e.fr...@ucl.ac.uk> writes:

> On Tuesday, 24 Jan 2017 at 14:14, Michael Welle wrote:
>> ohschockschwerenot, I found it. I set org-confirm-babel-evaluate to a
>> function that does look at the body of the code block and then decides
>> if it should be executed without confirmation or not.
>>
>> I'm not sure, why that is a problem. In the case of the examples, the
>> function returns t and that is the default value of o-c-b-evaluate.
>
> Interesting.  I cannot help with this but I would be quite interested in
> seeing your function in case it's something I could use!  Would it be
> possible to share?
it's quite a hack. I don't want Org to evaluate source code blocks
without confirmation. This could lead to all sorts of trouble. On the
other hand, there are a few source code blocks, that I want to eval
without confirmation. So I use this:


(defun hmw/org-post-publish-export-confirm-evaluate (lang body)
  (not (string-match "^#post publish exporter" body)))
  
(setq org-confirm-babel-evaluate 'hmw/org-post-publish-export-confirm-evaluate)

A source code block looks like follows:

#+BEGIN_SRC shell :exports results :shebang #!/bin/sh :var 
SRCDIR=(expand-file-name (plist-get plist :base-directory)) :var 
DESTDIR=(expand-file-name (plist-get plist :publishing-directory))
#post publish exporter
(
echo "Starting esxwithforeman.org $(date)"

cd ${SRCDIR}

echo "Finish esxwithforeman.org $(date)"
) >> /tmp/c0t0d0s0_publish.log 2>&1
#+END_SRC

As you can see, this is not a security feature, esp. now that I
published it ;).

Regards
hmw



Re: [O] git and orgmode: teaching git a bit of orgmode syntax

2017-01-24 Thread Michael Welle
Hello,

Nick Dokos  writes:
[...]
> Thanks. It is quite likely that I misremembered: I found some things on Worg
> about an org-aware merge tool for git:
>
> http://orgmode.org/worg/org-contrib/gsoc2012/student-projects/git-merge-tool/proposal.html
> http://orgmode.org/worg/org-contrib/gsoc2012/student-projects/git-merge-tool/
>
> but not for a diff tool. And I'm not sure it ever saw the light of day.
I will have a look at it later this week.

If you have enough information to perform a semantic merge, there should
be also enough information to spit out a diff. Defining what a
difference is in Org would be a starting point. An implementation will
follow then. Maybe a task for the next winter ;).

Regards
hmw



Re: [O] git and orgmode: teaching git a bit of orgmode syntax

2017-01-24 Thread Michael Welle
Hello,

Nick Dokos  writes:
[...]
> [fn:1] I'd search, but Gmane still seems non-compos-mentis and
>searching in the archives is just awful (or my fu is too
>weak). Anybody know what is happening with Gmane?  How do you
>search the list nowadays?
I have a mail folder with about 60k mails. The oldest seem to be 10
years old. I doubt that it is complete, but who knows. What should I
look for? I searched the subjects for gsoc|summer of code and found one
from 2013, IIRC. But that doesn't lead to anything. Searching for
difference in the subject wasn't fruitful either.

Regards
hmw



Re: [O] Table formula from code block

2017-01-24 Thread Michael Welle
Hello,

Eric S Fraga <e.fr...@ucl.ac.uk> writes:

> On Tuesday, 24 Jan 2017 at 10:52, Michael Welle wrote:
>> Eric S Fraga <e.fr...@ucl.ac.uk> writes:
>>> Works fine for me with relatively recent org from git.
>> that's strange. I pulled last sunday.
>
> Well, I have just this minute updated and tried again.  It still works
> for me.  
ohschockschwerenot, I found it. I set org-confirm-babel-evaluate to a
function that does look at the body of the code block and then decides
if it should be executed without confirmation or not.

I'm not sure, why that is a problem. In the case of the examples, the
function returns t and that is the default value of o-c-b-evaluate.

Regards
hmw




Re: [O] Table formula from code block

2017-01-24 Thread Michael Welle
Hello,

Roger Mason  writes:
[...]
> #+tblname: display-results
> | skribilo path   | infile | engine| To Engine | To 
> Typeset |
>
> |-++---+---+|
> | "/opt/skribilo-git/bin" | "skribilo-input-1" | "context" | Success |
> | Success |
>
> #+TBLFM: $4='(org-sbe "skribilo_to_engine" (path $1) (infile $2) (engine  $3) 
> )::$5='(org-sbe "engine_to_typeset" (path $1) (infile $2) (engine  $3) )
>
> Maybe emacs has a means of doing that wrapping, but the things I tried
> (like concatenating the quotes with the table entry with (concat...)) did
> not work.
There is a thread of Karl and me talking about that, maybe in last
november or december.


> I see that in your example you refer to the column heading in the
> #+TBLFM line.  In my working code I refer to the columns by number ($1,
> $2 etc).
Uhm, no ;). Unfortunately the column and the script block share the same
name in the example. That should be no problem, I changed that and still
no success with current Org. Org 8 works as expected.

Regards
hmw



Re: [O] Table formula from code block

2017-01-24 Thread Michael Welle
Hello,

Eric S Fraga <e.fr...@ucl.ac.uk> writes:

> On Tuesday, 24 Jan 2017 at 10:52, Michael Welle wrote:
>> Eric S Fraga <e.fr...@ucl.ac.uk> writes:
>>> Works fine for me with relatively recent org from git.
>> that's strange. I pulled last sunday.
>
> Well, I have just this minute updated and tried again.  It still works
> for me.  
I must doing something wrong. But what? I've changed org-bbdb, but that
shouldn't interfere.

Regards
hmw



Re: [O] Table formula from code block

2017-01-24 Thread Michael Welle
Hello,

Eric S Fraga <e.fr...@ucl.ac.uk> writes:

> On Monday, 23 Jan 2017 at 12:04, Michael Welle wrote:
>> Hello,
>>
>> I think there are several problems, starting with BEGIN_SRC sh and some
>> more. But fixing them doesn't bring success. I even have trouble to get
>> a minimal example to work:
>>
>> #+NAME: foo
>> #+BEGIN_SRC emacs-lisp
>> (+ 4 4)
>> #+END_SRC
>>
>>
>> |  bar   | foo|
>> |+|
>> | 42 | #ERROR |
>> #+TBLFM: $2='(org-sbe "foo")::$1=42
>
> Works fine for me with relatively recent org from git.

I just tried the Org version, that comes with Emacs (8.2.10) and there
the above example works as expected.

Regards
hmw



Re: [O] Table formula from code block

2017-01-24 Thread Michael Welle
Hello,

Michael Welle <mwe012...@gmx.net> writes:
...
> #+NAME: foo
> #+BEGIN_SRC emacs-lisp
>
> (+ 4 4)
> #+END_SRC
>
>
> |  bar   | foo|
> |+|
> | 42 | #ERROR |
>
> #+TBLFM: $2='(org-sbe "foo")::$1=42
>
> I'm not sure, what the problem is. Looking at org-sbe there is
> something, I don't understand. In the end org-babel-execute-src-block is
> called. That executes the _current_ source code block. But I don't
> understand, how foo (in this example) becomes the current source code
> block.
well, the docstring is a bit misleading, IMHO. Current source code block
means that the function looks around to find a source code block. I
though, it means the source code block 'I am in' at the moment.

I've tracked it down to org-babel-check-confirm-evaluate so far. In the
let*, export and eval are nil. The 5. element of info is nil, that means
(goto-char (nth 5 info)) will barf. Hmm.

Regards
hmw



  1   2   >