Re: org-table-blank-field key binding removal

2021-10-13 Thread Michael Brand
Hi all

Then Version 9.6 (or forget) seems right to me.

Michael



Re: org-table-blank-field key binding removal

2021-10-13 Thread Michael Brand
Hi all

The change is not announced in ORG-NEWS. I think it should be in Version 9.4.

Michael



Re: empty/nil in table cells

2020-07-10 Thread Michael Brand
Hi Mario

For such cases I use ~subseq~ to take the running window out of the
complete range ~@I$2..@II$2~:

|  date | measure | running avg |
|---+-+-|
| 01-27 | 604 | |
| 01-28 | 314 | |
| 01-29 | 636 | |
| 01-30 | 305 | |
| 01-31 | 760 | |
| 02-01 | 531 | |
| 02-02 | 331 |  497.29 |
| 02-03 |  77 |  422.00 |
| 02-04 | 621 |  465.86 |
| 02-05 | 406 |  433.00 |
| 02-06 | 621 |  478.14 |
| 02-07 | 975 |  508.86 |
| 02-08 | 252 |  469.00 |
| 02-09 | 794 |  535.14 |
| 02-10 |  36 |  529.29 |
#+TBLFM: $3 = '(let ((len 7)) (if (> @# len) (format "%.2f" (/ (apply
#'+ (subseq '(@I$2..@II$2) (- @# 1 len) (- @# 1))) (float len))) ""));
N

Michael



Statistic cookies for headings and list items

2020-03-31 Thread Michael Brand
Is this all intended behaviour?

When I start with ~C-c C-c~ on [ of line A, Org seems to count list items:

* [0/2] A
- [ ] B
- [ ] C
** DONE D

Then ~S-~ on line D seems to count subheadings:

* [0/1] A
- [ ] B
- [ ] C
** TODO D

Then ~C-c C-c~ on [ of line A seems to count list items again:

* [0/2] A
- [ ] B
- [ ] C
** TODO D

Then ~C-c -~ on line D makes D a subitem which makes no sense to me:

* [0/2] A
- [ ] B
- [ ] C
  - [ ] D

But when I start with this:

#+STARTUP: indent
* [0/2] A
- [ ] B
- [ ] C
** TODO D

Then ~C-c -~ on line D makes D a sibling which I prefer to the above:

#+STARTUP: indent
* [0/2] A
- [ ] B
- [ ] C
- [ ] D

Except that the automatic update like ~C-c C-c~ on [ of line A is missing:

#+STARTUP: indent
* [0/3] A
- [ ] B
- [ ] C
- [ ] D

(This is Org on today's master.)

Michael



Agenda initial state

2019-11-24 Thread Michael Brand
Hi all

I would like to ask for some help with the setup of
~org-agenda-start-with-log-mode~ and
~org-agenda-start-with-clockreport-mode~.

With the minimal setup below I can see the effect of
~org-agenda-clockreport-parameter-plist~ but when I open the agenda
with ~x~ the log and clockreport are not enabled initially, only after
typing ~l~ and ~R~. I tried several web searches and Worg to find an
answer but failed. Org mode version is a recent master.

#+begin_src emacs-lisp
  (setq
   org-agenda-custom-commands
   '(("x" "Log and report of clocking"
  ((agenda
"" ((org-agenda-files '("~/d/clock.org"))
(org-agenda-start-with-log-mode t)
(org-agenda-start-with-clockreport-mode t)
(org-agenda-clockreport-parameter-plist
 '(:hidefiles t :maxlevel 3 :narrow 25
#+end_src

Michael



Re: [O] Cut and paste an entry programmatically

2019-06-29 Thread Michael Brand
Hi Kyle

On Sat, Jun 29, 2019 at 2:58 AM Kyle Meyer  wrote:

> Hmm I don't consider that a bug.  It's documented behavior for kill
> commands to append to the last kill when called successively.
>
> ,[ C-h f kill-region RET ]
> | [...]
> | Any command that calls this function is a "kill command".
> | If the previous command was also a kill command,
> | the text killed this time appends to the text killed last time
> | to make one entry in the kill ring.
> | [...]
> `

Although I knew of course that ~C-k C-k~ appends it didn't ring the
bell it should have. And I was not aware of the concept of a "kill
command" which can make my function a "kill command", _depending on
how it is invoked_.

> In addition to what Samuel posted, another way for a lisp caller to
> avoid the append behavior if desired is to let-bind this-command so that
> kill-region's attempt to set it to kill-region doesn't work.  Using your
> example, that'd be
>
> #+begin_src emacs-lisp
> (defun temp ()
>   (let (this-command)
> (org-cut-subtree))
>   (org-forward-heading-same-level 2)
>   (org-paste-subtree))
> #+end_src

This is what I have been looking for, thank you.

Michael



Re: [O] Cut and paste an entry programmatically

2019-06-28 Thread Michael Brand
Hi Samuel

On Thu, Jun 27, 2019 at 11:57 PM Samuel Wales  wrote:
> does (kill-new "") in front of the kill fix it?

Good idea. Yes, it prevents reinsertion of "1". Same with (setq
kill-ring nil) in front of org-cut-subtree.

With your idea I debug printed kill-ring and found that after the
second invocation of org-cut-subtree during ~M-: (temp) RET M-: (temp)
RET~ it consists of only one list element with a string containing
both 1 and 2 instead of one list element with only 1 and another with
only 2. So to me this looks like a bug in org-cut-subtree.

Michael



[O] Fwd: Cut and paste an entry programmatically

2019-06-27 Thread Michael Brand
Hi all

I am still blocked with this issue. It looks like the content that is
pasted with the second invocation of org-paste-subtree is not just the
second org-cut-subtree but the accumulation of the first and the
second org-cut-subtree together. This MCE seems better to me than the
previous one as it does not use save-excursion:

#+begin_src emacs-lisp :results silent
  (defun temp ()
(goto-char (point-min))
(org-cut-subtree)
(forward-line 2)
(org-paste-subtree))
#+end_src

#+begin_src org
,* 1
,* 2
,* 3
,* 4
#+end_src

~M-: (temp) RET M-: (temp) RET~ results in

#+begin_src org
,* 3
,* 1
,* 1
,* 2
,* 4
#+end_src

with an unexpected reinsertion of "1" when inserting "2" resulting in
a duplicate "1".

Michael



-- Forwarded message -
From: Michael Brand 
Date: Thu, May 16, 2019 at 6:40 PM
Subject: Cut and paste an entry programmatically
To: Org Mode 

Hi all

I would like to ask for some help to understand what am I doing wrong
with this minimal complete example:

#+begin_src org
,* 1
,* 2
,* 3
,* 4
#+end_src

#+begin_src emacs-lisp :results silent
  (defun temp ()
(org-cut-subtree)
(org-forward-heading-same-level 2)
(org-paste-subtree))
#+end_src

When with point on 1 you do

M-: (progn (save-excursion (temp)) (save-excursion (temp))) RET

the resulting buffer is the expected reordered 3, 1, 2, 4. When you do

M-: (save-excursion (temp)) RET M-: (save-excursion (temp)) RET

the resulting buffer is 3, 1, 1, 2, 4 which is not what I want (Emacs
26.1 and today's Org mode master). Why is this and how to resolve?

Michael



Re: [O] table, calc, reorder and protect calculation in one cell

2019-06-17 Thread Michael Brand
Hi Uwe

On Tue, Jun 11, 2019 at 11:36 AM Uwe Brauer  wrote:

> Is this behavior possible? When I delete a row or a column, the  TBLFM
> is updated, could that be done for reordering?

You may want to use something like this, (I knew the syntax for ~"$1"~
and used the formula debugger ~C-c {~ to find the syntax for
~"(Smith)"~):

| name   | C1 | C2 | Res |
|+++-|
| Smith  |  9 |  1 | 1.7 |
| Miller |  6 |  2 |   8 |
| Adams  |  5 |  5 |  10 |
#+TBLFM: $4 = if("$1" == "(Smith)", 0.1 * $2 + 0.8 * $3, $3 + $2)

Michael



Re: [O] Cut and paste an entry programmatically

2019-05-17 Thread Michael Brand
Hi all

I found something else with ~org-paste-subtree~ that surprises me and
that reminds me of ~C-c *~ where I was never able to get a remindable
understanding of what it does until now when investigating deeper with
this minimal complete example:

#+begin_src org
,* a
,** b
- x
,** c
- y
,* d
,** e
- z
,*** f
,** g
#+end_src

With point on c and ~org-paste-subtree~ the level of the new heading
is 2 but on g the level is 3. Are the different levels intended
behavior? If yes it would mean the need to add logic to
programmatically get always the same level independent of the
structure of the previous heading. If no and the level would be always
2 or always 3 I would at least not find it confusing.

With point on x and ~C-c *~ the level of the new heading is 3 as
expected by me. But on y it is 2 where I would still expect 3 with the
strong argument that y should stay within c and not be "hierarchically
moved" to a. On z the resulting level 4 seems completely off.

Michael



[O] Cut and paste an entry programmatically

2019-05-16 Thread Michael Brand
Hi all

I would like to ask for some help to understand what am I doing wrong
with this minimal complete example:

#+begin_src org
,* 1
,* 2
,* 3
,* 4
#+end_src

#+begin_src emacs-lisp :results silent
  (defun temp ()
(org-cut-subtree)
(org-forward-heading-same-level 2)
(org-paste-subtree))
#+end_src

When with point on 1 you do

M-: (progn (save-excursion (temp)) (save-excursion (temp))) RET

the resulting buffer is the expected reordered 3, 1, 2, 4. When you do

M-: (save-excursion (temp)) RET M-: (save-excursion (temp)) RET

the resulting buffer is 3, 1, 1, 2, 4 which is not what I want (Emacs
26.1 and today's Org mode master). Why is this and how to resolve?

Michael



Re: [O] Column width cookies stopped working in 9.2.3?

2019-05-14 Thread Michael Brand
Hi all

Some opinions and very old history about exactly the same issue:

http://lists.gnu.org/archive/html/emacs-orgmode/2010-03/msg00766.html

|   | Mon   | Tue   | Wed   | Thu   | Fri   |
|---+---+---+---+---+---|
|  8:15 | Math  | Compute=> | - | Math  | Compute=> |
| 13:15 | - | Math  | Compute=> | - | Math  |

commit b34982368728d791c80e21f07f5046a050292f2d
Author: Carsten Dominik 
Date:   Sat Mar 27 16:13:45 2010 +0100

Tables: Interpret  as fixed width, not maximum width

Requested by Michael Brand

Michael



Re: [O] Structured links to headings with endless depth

2019-05-07 Thread Michael Brand
Hi Ihor

On Tue, May 7, 2019 at 5:27 AM Ihor Radchenko  wrote:

> I am wondering why you are strictly against ID properties.

To me this looks like a misunderstanding. I use the ID often but my
weighting of the different advantages is not the same in all cases.
Some situations where no ID can be seen as an advantage: Looking at
the raw view (for example visible-mode during ediff), looking at the
raw file (when in the other world outside of Org mode), the time it
can take to not find an ID in all the ID files when the target file or
ID is not accessible, etc. There must be good reasons why some more
users than just me sometimes prefer the format B over A:

#+name: A
#+begin_src org
- [[id:8e5c5d87-291e-469b-a8e4-15704610c82c][The heading name]]
,* The heading name
  :PROPERTIES:
  :ID:   8e5c5d87-291e-469b-a8e4-15704610c82c
  :END:
#+end_src

#+name: B
#+begin_src org
- [[*The heading name]]
,* The heading name
#+end_src

Michael



Re: [O] Structured links to headings with endless depth

2019-05-06 Thread Michael Brand
Hi all

On Wed, Mar 14, 2018 at 7:58 AM Michael Brand
 wrote:

> ,(arbitrarily more levels upwards)
> ,  * [...]
> ,* 
> ,  * 
> ,* TODO 
> ,  *  :5:
> ,- The tag 5 is my rating of this audio recording.
> ,- The audio recording is stored under the file path
> ,  [...]/.mp3
> ,
> ,* TODO [...]
> ,  - The theme is very similar to this prelude
> ,[[/://]].
> ,* [...]
> ,  - [...] like in this piano concert
> ,[[/:/]].

Despite all the valuable recommendations in this thread I implemented
something simple for my very specific use case of a music database
where I want self-explaining links with the already existing and
complete heading structure and don't want to add any ID, CUSTOM_ID or
<>. See this example:

#+begin_src org
,#+STARTUP: oddeven showeverything

Specs for outline path of links to a heading, any combinations allowed
including none:
- "/" delimits headings of adjacent levels.
- A leading "/" requires matching the top level heading.
- "//" delimits heading levels with 0 to n discarded heading levels
between them.

Demo examples:
- Goes to tag 1: [[*Chopin/Prelude]]
- Goes to tag 2: [[*/Prelude]]
- Goes to tag 3: [[*d/c//b/a]]
- Goes to tag 4: [[*d/c/b/a]]
,* Foo
,** Bach
,*** Prelude
,** Chopin
,*** Prelude :1:
,* Prelude :2:
,* d
,** c
,*** Bar
, Baz
,* b
,** a :3:
,*** b
, a :4:
#+end_src

Limitations of this simplified implementation:
- Export of links with a path to a heading is not supported.
- Links to a heading with "/" that existed before are broken.
- There may be other issues for your use case already discussed in the
current thread (
http://lists.gnu.org/archive/html/emacs-orgmode/2018-03/msg00231.html
).

Due to the limitations this implementation is for private use only and
not meant to be commited upstream although the format of the attached
patches might imply that.

Michael
From 3a594dfa9967ed4fd70aae04559dde757fb21b1b Mon Sep 17 00:00:00 2001
From: Michael Brand 
Date: Mon, 6 May 2019 18:17:52 +0200
Subject: [PATCH 1/2] org-get-heading: New parameter no-cookie

* lisp/ol.el (org-link-search): Remove regexps for comment and cookie.
* lisp/org.el (org-get-heading:): New parameter no-cookie used above.
---
 lisp/ol.el  | 10 ++
 lisp/org.el | 11 +--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index a6f76a39f..f5bd63e96 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1108,18 +1108,12 @@ of matched result, which is either `dedicated' or `fuzzy'."
 		  (format "%s.*\\(?:%s[ \t]\\)?.*%s"
 			  org-outline-regexp-bol
 			  org-comment-string
-			  (mapconcat #'regexp-quote words ".+")))
-		 (cookie-re "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]")
-		 (comment-re (format "\\`%s[ \t]+" org-comment-string)))
+			  (mapconcat #'regexp-quote words ".+"
 	 (goto-char (point-min))
 	 (catch :found
 	   (while (re-search-forward title-re nil t)
 		 (when (equal words
-			  (split-string
-			   (replace-regexp-in-string
-cookie-re ""
-(replace-regexp-in-string
- comment-re "" (org-get-heading t t t)
+			  (split-string (org-get-heading t t t t t)))
 		   (throw :found t)))
 	   nil)))
   (beginning-of-line)
diff --git a/lisp/org.el b/lisp/org.el
index 94713a7e5..48f7874ac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6938,12 +6938,14 @@ So this will delete or add empty lines."
 (insert (make-string n ?\n))
 (move-to-column column)))
 
-(defun org-get-heading ( no-tags no-todo no-priority no-comment)
+(defun org-get-heading (
+			no-tags no-todo no-priority no-comment no-cookie)
   "Return the heading of the current entry, without the stars.
 When NO-TAGS is non-nil, don't include tags.
 When NO-TODO is non-nil, don't include TODO keywords.
 When NO-PRIORITY is non-nil, don't include priority cookie.
 When NO-COMMENT is non-nil, don't include COMMENT string.
+When NO-COOKIE is non-nil, don't include cookie string.
 Return nil before first heading."
   (unless (org-before-first-heading-p)
 (save-excursion
@@ -6958,7 +6960,12 @@ Return nil before first heading."
 			   (replace-regexp-in-string
 			(eval-when-compile
 			  (format "\\`%s[ \t]+" org-comment-string))
-			"" h))
+			""
+			(if no-cookie
+(replace-regexp-in-string
+ "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]"
+ "" h)
+			  h)))
 			  (h h)))
 	  (tags (and (not no-tags) (match-string 5
 	  (mapconcat #'identity
-- 
2.20.1

From fee37436abbe4a7d6b79161b9230f02de6e7d54d Mon Sep 17 00:00:00 2001
From: Michael Brand 
Date: Mon, 6 May 2019 18:19:44 +0200
Subject: [PATCH 2/2] org-link-search:

Re: [O] [RFC] Fixing link encoding once and for all

2019-03-01 Thread Michael Brand
On Fri, Mar 1, 2019 at 9:15 AM Nicolas Goaziou  wrote:

> Thinking a bit more about it, we don't need to escape /all/ square
> brackets, only "]]" and "][" constructs. Therefore, we don't need to
> escape every backslash either.

Brilliant!



Re: [O] Format of links to Info node and Info index

2019-02-07 Thread Michael Brand
Hi all

On Sat, Feb 2, 2019 at 11:14 AM Michael Brand
 wrote:

> [...] Now I am confused about
> the difference of info:org#Feedback that is documented as a link to an
> info _node_ in [[info:org#External Links]] but never used in
> org-manual.org versus info:org::Feedback that is not documented in
> org-manual.org but used for all Info links there, like for example in
> the section info:org::Activation for the link to Key Binding
> Conventions. [...]

Short version: I would just like to know how to fix my Org files. Is
the rule to use info:org::Feedback or info:org#Feedback ?

Michael



[O] Format of links to Info node and Info index

2019-02-02 Thread Michael Brand
Hi all

I noticed that the link format with only single colons for the Info
node like info:org:Feedback stopped to work. Now I am confused about
the difference of info:org#Feedback that is documented as a link to an
info _node_ in [[info:org#External Links]] but never used in
org-manual.org versus info:org::Feedback that is not documented in
org-manual.org but used for all Info links there, like for example in
the section info:org::Activation for the link to Key Binding
Conventions.

Currently both link formats can also be used for links to Info
_index_, for example info:org::table.el and info:org#table.el

Should there be a different link format for Info node versus Info index or not?

Who would prefer (my favorite)

| =info:org::External links= | Info node, preferred format  |
| =info:org#External links=  | (alternative format) |
| =info:org#table.el=| Info index, preferred format |
| =info:org::table.el=   | (alternative format) |

or who would prefer

| =info:org::External links= | Info node link  |
| =info:org#table.el=| Info index link |

or who would prefer something else?

Michael



Re: [O] Date macro and file permission

2019-01-22 Thread Michael Brand
Hi Nicolas

On Tue, Jan 22, 2019 at 9:03 AM Nicolas Goaziou  wrote:

> Michael Brand  writes:
>
> > Thank you for looking into it. Now it asks "Buffer  *temp* modified;
> > kill anyway?".
>
> Oh, so that (restore-buffer-modified-p nil) was useful…
>
> Fixed. Thank you.

Confirmed, thank you.

Michael



Re: [O] Date macro and file permission

2019-01-21 Thread Michael Brand
Hi Nicolas

On Mon, Jan 21, 2019 at 9:47 PM Nicolas Goaziou  wrote:

> Michael Brand  writes:
>
> > Visiting a read-only file that uses the ~#+date:~ macro results in the
> > message "File mode specification error: (buffer-read-only # > buffer>)" and a not properly initialized Org buffer. For example Org
> > indent does not indent and some faces show a wrong color. I tried
> > today's master branch and found the regression here
> >
> > commit 5f5d82ed516b7b385a9258271becbfa247e94af3
> > Author: Nicolas Goaziou 
> > Date:   Tue Nov 21 22:25:17 2017 +0100
> >
> > Remove second pass for macro expansion
>
> Fixed. Thank you.

Thank you for looking into it. Now it asks "Buffer  *temp* modified;
kill anyway?".

Michael



[O] Date macro and file permission

2019-01-21 Thread Michael Brand
Hi all

Visiting a read-only file that uses the ~#+date:~ macro results in the
message "File mode specification error: (buffer-read-only #)" and a not properly initialized Org buffer. For example Org
indent does not indent and some faces show a wrong color. I tried
today's master branch and found the regression here

commit 5f5d82ed516b7b385a9258271becbfa247e94af3
Author: Nicolas Goaziou 
Date:   Tue Nov 21 22:25:17 2017 +0100

Remove second pass for macro expansion

Michael



Re: [O] Calculate differences of remote table numbers

2018-10-05 Thread Michael Brand
Hi Karl

On Mon, Oct 1, 2018 at 5:02 PM Karl Voit  wrote:

> I'd like to calculate the differences between rows of numbers of a
> different table.

For this kind of shifting row or column indexes I use Calc vector
subscript. In your case:

#+NAME: my-table
| Numbers |
|-|
|   1 |
|   5 |
|   8 |
|  12 |
|  15 |

| Line | Difference |
|--+|
|1 ||
|2 |  4 |
|3 |  3 |
|4 |  4 |
|5 |  3 |
#+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table,
@I$1..@II$1), @# - 1) - subscr(remote(my-table, @I$1..@II$1), @# - 2))

or, avoiding @# completely in the formula for $2:

#+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table,
@I$1..@II$1), $1) - subscr(remote(my-table, @I$1..@II$1), $1 - 1))

See also a similar example of subscr in the subsection "Dynamic
variation of ranges" here:
https://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas

Michael



Re: [O] Link "bracket-types"

2018-05-17 Thread Michael Brand
Hi all

On Sat, May 12, 2018 at 10:12 AM, Michael Brand
<michael.ch.br...@gmail.com> wrote:

> Thank you for the patch. I changed it (attached) to something that
> preserves org-toggle-link-display and allows more different configs
> for more different usages, please see the docstring of
> org-link-brackets. I tried it out with org-toggle-link-display and for
> org-link-brackets '(0 0), '(1 1) and '(0 2).

Another use case for playing with org-link-brackets config:

In my opinion the underline in the org-link face makes descriptive
links with many words less readable. Currently I try out underline
turned off. To compensate for the missing indication of beginning and
end of adjacent descriptive links I changed org-link-brackets from my
previous '(0 2) to '(1 2) to get 1 bracket pair around descriptive
links.

For those interested in readability:

Put the following without the #-lines in an empty Org buffer (with the
default face for org-link and underline) and try to read as fast as
possible.

#+begin_example
 8<  cut here  8< 

1) TIHS IS RAEADLBE BCUSEAE TEH HUAMN MNID DEOS
   NTO RAED ERVEY LTETER BY ISTLEF, BTU TEH WROD AS A WLOHE

2) [[http://example.com][Tihs is raeadlbe bcuseae teh huamn mnid deos
   nto raed ervey lteter by istlef, btu teh wrod as a wlohe]]

3) _Tihs is raeadlbe bcuseae teh huamn mnid deos
   nto raed ervey lteter by istlef, btu teh wrod as a wlohe_

4) Tihs is raeadlbe bcuseae teh huamn mnid deos
   nto raed ervey lteter by istlef, btu teh wrod as a wlohe

 8<  cut here  8< 
#+end_example

To my understanding underline and UPPERCASE decrease readability
because they affect the bouma.

http://en.wikipedia.org/wiki/Bouma

michael
ʅǝɐɥɔᴉɯ



[O] org-link customization and org-open-link-functions

2018-05-17 Thread Michael Brand
Hi all

Customization of the face org-link changes org-open-link-functions
resulting in org-open-at-point asking for a TAGS file. Is that
intended behavior?

- M-x org-mode
- M-x customize
- org-open-link-functions is now nil
- In customization navigate to org-link and open it
- org-open-link-functions is now (org-ctags-find-tag
org-ctags-ask-rebuild-tags-file-then-find-tag
org-ctags-ask-append-topic)

Org release_9.1.13-757-g463664 with Emacs 25.2.

Michael



Re: [O] Parsing of todo state log lines

2018-05-16 Thread Michael Brand
Hi Nicolas

On Wed, May 16, 2018 at 10:42 PM, Nicolas Goaziou
 wrote:

> I didn't test logging, but `org-skip-over-state-notes' definitely goes
> past the three items, so I guess `org-log-beginning' should put point at
> the end of the three items, too.

Indeed, it works all as expected. Thank you! (Sorry, my fault was that
the invalid example line with "" was not removed yet.)

Michael



Re: [O] Parsing of todo state log lines

2018-05-16 Thread Michael Brand
Hi

On Wed, May 16, 2018 at 10:08 PM, Nicolas Goaziou
 wrote:

> You are right. It should be empty, not "". I think I fixed it in maint.

I still get the new log in the middle line with
release_9.1.13-757-g463664b after restarting Emacs. Did you get the
new log after the last line?

Michael



Re: [O] Parsing of todo state log lines

2018-05-16 Thread Michael Brand
Hi Nicolas

On Wed, May 16, 2018 at 9:07 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> Hello,
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>> There seems to be an inconsistency in parsing. When
>> org-log-states-order-reversed is nil (which I am new to) and a TODO
>> with the manually written state log lines
>>
>> - State "DONE"   from "TODO"   [2018-05-12 Sat]
>> - State "DONE"   from  [2018-05-13 Sun]
>
> I think it should be
>
>   - State "DONE"   from ""   [whatever]
>
> according to `org-log-note-headings'.

I don't see this happen: When starting with this (the % and the
ordering of the lines have been edited manually)

- State "DONE"   from "TODO"   [2018-05-15 Tue 10:00]
- State "DONE"   from "%"  [2018-05-15 Tue 10:00]
- State "DONE"   from ""   [2018-05-15 Tue 10:00]
- State "DONE"   from  [2018-05-15 Tue 10:00]

and without todo keyword in the heading the logs change to

- State "DONE"   from "TODO"   [2018-05-15 Tue 10:00]
- State "DONE"   from "%"  [2018-05-15 Tue 10:00]
- State "DONE"   from  [2018-05-16 Wed 21:45]
- State "DONE"   from ""   [2018-05-15 Tue 10:00]
- State "DONE"   from  [2018-05-15 Tue 10:00]

So also "" is not recognized. And the new middle line is produced without "".

Michael



[O] Parsing of todo state log lines

2018-05-15 Thread Michael Brand
Hi all

There seems to be an inconsistency in parsing. When
org-log-states-order-reversed is nil (which I am new to) and a TODO
with the manually written state log lines

- State "DONE"   from "TODO"   [2018-05-12 Sat]
- State "DONE"   from  [2018-05-13 Sun]
- State "DONE"   from "TODO"   [2018-05-14 Mon]

is changed to DONE the new state log line is expected to go after the
third line but it goes after the first like if the second was missed
by the parser. When the same state log lines are in a habit they are
all recognized for the consistency graph where they appear as a star,
but still the new state log line goes after the first line.

Found in Org release_9.1.13-751-g9dcc522.

Michael



Re: [O] Link "bracket-types"

2018-05-12 Thread Michael Brand
Hi Nicolas

Thank you for the patch. I changed it (attached) to something that
preserves org-toggle-link-display and allows more different configs
for more different usages, please see the docstring of
org-link-brackets. I tried it out with org-toggle-link-display and for
org-link-brackets '(0 0), '(1 1) and '(0 2).

Michael


org-link-brackets.diff
Description: Binary data


Re: [O] Link "bracket-types"

2018-05-11 Thread Michael Brand
On Fri, May 11, 2018 at 3:10 PM, Nicolas Goaziou  wrote:
> Completing myself,
>
> Nicolas Goaziou  writes:
>
>> If you mean that fontification should show one pair of brackets instead
>> of hiding them all, I suggested it already, users found it added too
>> much cruft.
>>
>> You may want to check ML archives about it.
>
> I searched the ML archives about that. It was a thread named
>
>   [RFC] Change visibility for bracket links
>
> in which you participated.
>
> It never ended on anything concrete because the involved participants
> disagreed on the default value -- or, to put it differently, I disagreed
> with mostly anyone else -- and some users suggested another way to do
> it, but never implemented their suggestion fully.

Thanks for the hint, found and read it again:
http://lists.gnu.org/archive/html/emacs-orgmode/2016-10/msg00136.html

To summarize the thread there, the initial proposal there was that the links

#+begin_example
1) [[https://en.wikipedia.org/wiki/Filter][Filter (Wikipedia en)]]
2) https://en.wikipedia.org/wiki/Filter
3) [[https://en.wikipedia.org/wiki/Filter]]
4) [[https://en.wikipedia.org/wiki/Filter_(higher-order_function)]]
5) 
#+end_example

are rendered as

#+begin_example
1) [Filter (Wikipedia en)]
2) https://en.wikipedia.org/wiki/Filter
3) [https://en.wikipedia.org/wiki/Filter]
4) [https://en.wikipedia.org/wiki/Filter_(higher-order_function)]
5) 
#+end_example

To summarize the thread here: By changing org-activate-links

#+begin_example
-   (visible-start (or (match-beginning 4) (match-beginning 2)))
+   (visible-start (or (match-beginning 4) start))
-   (visible-end (or (match-end 4) (match-end 2
+   (visible-end (or (match-end 4) end)))
#+end_example

the links are rendered as

#+begin_example
1) Filter (Wikipedia en)
2) https://en.wikipedia.org/wiki/Filter
3) [[https://en.wikipedia.org/wiki/Filter]]
4) [[https://en.wikipedia.org/wiki/Filter_(higher-order_function)]]
5) 
#+end_example

which for me is the exact right amount of show and hide of _both_
bracket pairs and URL for all cases 1..5 in all my use cases.
Inclusive org-toggle-link-display to toggle only case 1.

For me this is the better solution than my initial idea of different
faces for the different cases. Not at least because aligned tables and
filled paragraphs with links like
#+begin_example
[[abbrev:123]]
#+end_example
are aligned and filled also in non-Org tools.

(For the last reason I use links of case 1 almost never in filled
paragraphs, almost only in un-filled paragraphs with Visual Line mode.
In filled paragraphs I avoid case 1 by using case 2 (or if necessary 4
or 5) and if helpful prepend a "description" just as Org-semantically
normal text, separated from the URL with whitespace.)

I will continue to use this change in my local branch.

> Anyway, here is an updated patch from the original thread, as a POC. It
> adds `partial' to `org-descriptive-links'. It isn't complete, as
> `org-toggle-link-display' should be altered so as to not modify
> `org-descriptive-links'.

Do you mean here attached and updated as of today?

> Maybe it's time for an old idea revival.

Currently we disagree in that you suggest one bracket where I prefer
none for descriptive links and you suggest one bracket where I prefer
two for the other cases, see rendering examples and my reasons for raw
plain text in non-Org tools above. If there would be an option to show
0 (current behavior), 1 (your suggestion) or 2 brackets (new)
everywhere I could use 2 as a compromise. If the option 0, 1 or 2
would be individual for case 1 and for case 3/4 that would of course
be perfect at least for me.

Michael



Re: [O] Link "bracket-types"

2018-05-10 Thread Michael Brand
Hi Nicolas

On Thu, May 10, 2018 at 6:27 PM, Nicolas Goaziou  wrote:

> IIUC, you want fontification to make it obvious there are square
> brackets in links, so that you know when they can be removed, for
> improved readability outside Org.

Yes, and generally just to see what is going on in Org with a little
bit more details.

In the meantime I tried a changed org-activate-links

#+begin_example
-   (visible-start (or (match-beginning 4) (match-beginning 2)))
+   (visible-start (or (match-beginning 4) start))
-   (visible-end (or (match-end 4) (match-end 2
+   (visible-end (or (match-end 4) end)))
#+end_example

to show the brackets of case 3/4 always which I even prefer over my
earlier proposal of fontification. And org-toggle-link-display can
still be used to toggle case 1.

Somehow I don't like to hide the brackets for case 3/4 where nothing
else is to be hidden.

> If I'm correct, why don't you write a function that normalizes links for
> you, so you don't have to bother, e.g., something that turns [[URL]]
> into URL unless URL contains parenthesis or spaces?

The search criteria is more complex because e. g.
: https://en.wikipedia.org/wiki/Filter_(signal_processing)
does not need brackets.

The changed org-activate-links works better for me than an automatic
normalization as I don't need and want to change all
: [[URL]]
now and prefer something similar to lazy evaluation: Change such links
only when I stumble upon for some other reason because after bracket
removal or replacement with angle brackets I have to interact anyway
with org-fill-paragraph and table realignment etc. because I used
org-descriptive-links nil before.

Michael



Re: [O] Link "bracket-types"

2018-05-10 Thread Michael Brand
Hi Nicolas

On Thu, May 10, 2018 at 3:33 PM, Nicolas Goaziou  wrote:

> Sorry for being dense, but I still don't get it.

I can not claim to have been clear enough, hope to make it clearer below.

> When using non-Org tools, the solution doesn't belong to Org, does it?
> I mean, we are talking about fontification in Emacs Org mode. Tweaking
> it will not change the output of these other tools.

Agreed.

> This is probably obvious to you, but again, this is a genuine question:
> how would you use /in Org/ the information about the brackets
> surrounding the link? A concrete example would probably help.

Only when I can see the brackets of case 3 in Org rendered as
: [[https://en.wikipedia.org/wiki/Filter]]
I know that I can change it to
: https://en.wikipedia.org/wiki/Filter
for a cleaner view in non-Org tools.

For case 1 I still prefer to see only the link description because I
prefer to hide a too disturbing URL part most of the times. My example
for case 1 is only artificial and my actual descriptions will be such
that it can not be confused with case 2.

I hope the previously described idea of a third value for
org-descriptive-links or something similar makes some sense.

Michael



Re: [O] Link "bracket-types"

2018-05-10 Thread Michael Brand
Hi Nicolas

On Thu, May 10, 2018 at 2:44 PM, Nicolas Goaziou  wrote:

> I still don't understand what your use case is about. Why do you care
> about the presence of square brackets?

Because I care about the raw file content that I see when using
non-Org tools like mainly git but also diff, grep, less, vi and
whatever.

> It is difficult to think about the pertinence of a solution if the
> problem is not well defined.

I could use org-descriptive-links nil to make the brackets visible.
But I would prefer a compromise like I mentioned in my last post: Case
1 like with org-descriptive-links t and case 3/4 like with
org-descriptive-links nil.

Michael



Re: [O] Link "bracket-types"

2018-05-10 Thread Michael Brand
Hi Nicolas

Thank you for looking into this.

On Thu, May 10, 2018 at 10:14 AM, Nicolas Goaziou
 wrote:

> Just move the mouse over them. A tooltip or the minibuffer will display
> what the link is really.

During my use case I don't care what URL the link opens. I want to
know if there are brackets and even better when I know whether they
are case 1 or 3/4.

> True. This limitation is a feature. You cannot have parenthesis in plain
> links even though they are technically allowed in URL.
>
> However, you could also use angle brackets.
>
> 
>
> The advantage on angle brackets is that they make it clear there is no
> description attached to the link, i.e., the brackets are visible when
> fontified). You can also use angle brackets for a more prominent visual
> clue.

Good to know, I didn't (or forgot?).

> I'm not sure to understand the problem you want to solve. What is
> important is if the displayed part of a link is a description or the URL
> itself, i.e., case 1. This is solved by hovering the mouse above the
> link. The other cases are equivalent, barring the limitation from case
> 2.

My use case is different, see above, and I don't like to move point or
mouse for my use case. I would like to have a visual indication like
with org-descriptive-links nil which leads to this thought:

Probably better than more faces would be to render case 1 like with
org-descriptive-links t and case 3/4 like with org-descriptive-links
nil. What would be the recommended way to do this? Could that become a
new value beside the current t and nil for org-descriptive-links?

Michael



[O] Link "bracket-types"

2018-05-10 Thread Michael Brand
Hi all

For the four different Org link "bracket-types" shown below I would
like to have four different faces to be able to distinguish them at
first sight. What is the recommended way to do this?

The four Org link bracket-types by example:

Buffer raw content (or visible-mode):
: 1) 
[[https://en.wikipedia.org/wiki/Filter#References][https://en.wikipedia.org/wiki/Filter]]
: 2) https://en.wikipedia.org/wiki/Filter
: 3) [[https://en.wikipedia.org/wiki/Filter]]
: 4) [[https://en.wikipedia.org/wiki/Filter_(higher-order_function)]]

(To try them out copy the above into an Org buffer and remove the colons.)

Currently rendered all with the same face as:
: 1) https://en.wikipedia.org/wiki/Filter
: 2) https://en.wikipedia.org/wiki/Filter
: 3) https://en.wikipedia.org/wiki/Filter
: 4) https://en.wikipedia.org/wiki/Filter_(higher-order_function)

As you know and can see above 1) to 3) can not be distinguished when
rendered with the default of org-descriptive-links t.

The brackets for 3) are optional as 2) opens the same URL.

The brackets for 4) are mandatory because without them
"_(higher-order_function)" is not fontified and not recognized by
org-open-at-point as part of the Org link any more. I think 4) can be
distinguished from 3) by comparing the bracket content with the part
fontified and/or recognized as Org link when the bracket content
without the brackets is matched/parsed again stand-alone.

org-descriptive-links permanently nil does not seem to be an
alternative as it disturbs text flow and org-fill-paragraph.
org-toggle-link-display does not seem to be an alternative as it would
have to be toggled forth and back on every new window scroll view.

Michael



[O] org-indent-mode and wrapping of bullet

2018-05-05 Thread Michael Brand
Hi all

When an item or heading with a single word is wider than the buffer
width it is shown as

│-│
│http://www.orgmode.org/z\│
│zzz  │
│*│
│http://www.orgmode.org/z\│
│zzz  │

when not in org-indent-mode which I understand from a
wrapping-code-complexity view. But in org-indent-mode the word is
still on its own line

│-│
│  http://www.orgmode.org/zzz\│
│  z  │
│*│
│  http://www.orgmode.org/zzz\│
│  z  │

where I expect the much nicer looking and space saving

│- http://www.orgmode.org/zzz\│
│  z  │
│* http://www.orgmode.org/zzz\│
│  z  │

Is this a missing feature of org-indent-mode?

Michael



Re: [O] Structured links to headings with endless depth

2018-03-14 Thread Michael Brand
Hi John

On Wed, Mar 14, 2018 at 4:49 AM, John Kitchin  wrote:
> (defun xpath-follow (path)

Thank you for this solution. I plan to adapt it to match the link path
only to a portion of a headline branch by ignoring the higher and
lower levels not given in the link path for my use case:

,(arbitrarily more levels upwards)
,  * [...]
,* 
,  * 
,* TODO 
,  *  :5:
,- The tag 5 is my rating of this audio recording.
,- The audio recording is stored under the file path
,  [...]/.mp3
,
,* TODO [...]
,  - The theme is very similar to this prelude
,[[/://]].
,* [...]
,  - [...] like in this piano concert
,[[/:/]].

Michael



Re: [O] problem with empty column

2018-01-05 Thread Michael Brand
Hi Uwe

On Fri, Jan 5, 2018 at 1:44 PM, Uwe Brauer  wrote:

> But fails if there is a row like this
>
> | Name   | E1 | E2 | E3 | E4 | Res |
> |+++++-|
> | Entry1 |||||  NP |
> | Entry2 | 10 | 20 | 30 | 40 |  10 |
> | Entry3 | 10 || 20 | 30 | nan |
> #+TBLFM: $6=if("$2" == "nan", string("NP"),($2+$3+$4+$5)/10);E

I think you are looking for this:

| Name   | E1 | E2 | E3 | E4 | Res |
|+++++-|
| Entry1 ||||| NP  |
| Entry2 | 10 | 20 | 30 | 40 | 10  |
| Entry3 | 10 || 20 | 30 | NP  |
#+TBLFM: $6 = if(typeof(vsum($2..$5)) == 12 , string("NP"),
vsum($2..$5) / 10); E

See the example

if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E

in the manual.

Michael



Re: [O] orgstruct-mode and colorizing headings.

2017-09-23 Thread Michael Brand
Hi Nonono

On Sat, Sep 23, 2017 at 9:40 AM, Nonono  wrote:

> Hello orgmode! I have a question that I searched on the internet and
> manuals about one hour, but still don't find out how.
>
> How to change the face of headings when in the orgstruct-mode? I think
> It would be neat if the color of heading have been different than normal
> the comment line in orgstruct-mode.
>
> I examined the face of headings when orgstruct-mode is on, but It was
> the same `font-lock-comment-face' of the vanilla state, so I think
> there're no plan and no way to change the color of headings other than
> changing the source code or making a new minor mode. Does someone have
> a idea or a recommendation on this particular subject?

I think this would not be easy to hack with orgstruct-mode. Also, see
this thread for its future:
"[RFC] Remove Org Struct mode"
http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00482.html
http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00032.html

I would recommend outshine which has fontified headings (on by default
and can also be turned off).
http://github.com/alphapapa/outshine

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-09-09 Thread Michael Brand
Hi Thorsten

First thank you very much for creating outshine.

On Sat, Sep 9, 2017 at 8:20 PM, Thorsten Jolitz  wrote:

> I'm not sure how orgstruct-mode does it, but since outshine is a minor
> mode, it cannot use Key bindings exactly like Org, since many of these
> are used in other major modes too.
>
> It is not easy to find a prefix for a minor mode that is easy to type
> but won't conflict with major modes.

Later I found that I don't have to use the outshine prefix key at all.
Outshine hijacks TAB like orgstruct-mode when on a headline and for
the other commands that orgstruct-mode hijacks as well I use now the
outshine speed commands. They work perfect with vi emulation by
switching to Emacs state (E) and back when done.

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-09-05 Thread Michael Brand
On Tue, Aug 22, 2017 at 7:48 PM, Michael Brand
<michael.ch.br...@gmail.com> wrote:

> 6) No syntax highlighting of headings

To get the above behavior of orgstruct-mode in outshine for
programming modes I added outshine-fontify. It makes me ready to let
orgstruct-mode go.

  outshine-fontify is a variable defined in ‘outshine.el’.
  Its value is (closure (t) nil (not (derived-mode-p 'prog-mode)))
  Original value was t

This variable is safe as a file local variable if its value
satisfies the predicate ‘(lambda (v) (memq v (quote (t nil’.

  Documentation:
  When to fontify the outshine headings in a buffer.

  Possible values are:

   ‘t’Always (the default).
   ‘nil’  Never.
   function   A Lisp predicate function with no arguments. For example
  ‘(lambda () (not (derived-mode-p (quote prog-mode’
  fontifies only when not in a programming mode.

  ‘t’ and ‘nil’ can be used for a file local variable to make an
  exception for certain files or to be independent of the user’s
  customization.

  You can customize this variable.

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-08-27 Thread Michael Brand
Hi Adam

On Wed, Aug 23, 2017 at 5:14 PM, Adam Porter  wrote:

> ;; Regular comment
> ;;; Heading level 1
>  Heading level 2
> ...
>
> Then any comment that starts with 3 or more semicolons is indented to
> the left edge and becomes a collapsible heading, regardless of the
> indentation of the code under it.

I assume in the above sentence you meant that a comment to be a
heading has not to be indented. That is at least what I observed, and
was able to change:

In the setup code you provided (to be used with plain Outline minor
mode without outshine) with

  (setq outline-regexp "\\(;;[;]\\{1,8\\} \\|\\((defun\\)\\)")

when " *" is added at the beginning to respect indentation

  (setq outline-regexp " *\\(;;[;]\\{1,8\\} \\|\\((defun\\)\\)")

the indented comments are also considered a heading.

This makes me believe that in Outline major mode and maybe partly also
in Org mode even this

* Heading level 1
  * Heading level 2

could be made to work by tweaking outline-regexp and outline-level.

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-08-23 Thread Michael Brand
Hi Rasmus

On Wed, Aug 23, 2017 at 9:17 PM, Rasmus  wrote:

> FWIW, I use similar patterns,
>
> ;; outline-regexp: ";;\\*+\\|\\`"
> ;; orgstruct-heading-prefix-regexp: ";;\\*+\\|\\`"

Thank you, I will try that out.

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-08-23 Thread Michael Brand
Hi Adam

Thank you for all the explanations that I will study and try later.
Especially the origami package looks very useful to me.

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-08-23 Thread Michael Brand
Hi Adam

First thank you for taking over maintenance of outshine.el from Thorsten Jolitz.

On Wed, Aug 23, 2017 at 1:33 PM, Adam Porter  wrote:
> Rasmus  writes:
>
>> I also would like to see a minor-mode for Org-like cycling when using
>> outline-minor-mode, as I use this feature in init.el.
>
> Outshine provides this feature.  In my init file, I have headers like:
>
>  Org
>
> And when I press TAB with point on that line, it collapses everything
> between it and the next header.

How can I collapse block-indented comments like a or b in the following?:

;; * Org
(defun foo ()
  ;; ** a
  (bar)
  ;; ** b
  (beer))
;; * Calc

orgstruct-mode supports it with orgstruct-heading-prefix-regexp set to
for example " *;;;* ".

A bit less important for me: How can I turn off syntax highlighting of
headings, respectively generally in outshine.el?

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-08-22 Thread Michael Brand
Thanks for pointing out speed keys in outshine.el that I was not aware
of. However I still failed.

My requirements for orgstruct-mode or its replacement are very limited
compared to what orgstruct-mode or outshine.el do or intend to do:

1) Only headings, no lists
2) No structure editing, only cycling and navigation
3) Key bindings accessible directly also in vi emulation
4) Key bindings exactly like Org
5) Headings also in block-indented comments (on its own line)
6) No syntax highlighting of headings
7) Org original special folding of the ARCHIVE tag

Note that I need all this only for a limited amount of Org functions
(a subset of orgstruct-setup):

- TAB (org-cycle)
- S-TAB (org-cycle)
- C-TAB (org-force-cycle-archived)
- C-c C-f (org-forward-heading-same-level)
- C-c C-b (org-backward-heading-same-level)
- C-c C-n (outline-next-visible-heading)
- C-c C-p (outline-previous-visible-heading)
- C-c C-u (outline-up-heading)

All items 3)..7) are supported in orgstruct-mode, in outshine.el I was
not able to make them work. If I want to use the speed keys in
outshine.el with vi emulation I have to switch to Emacs mode and back
where in orgstruct-mode I can stay and use simply TAB/S-TAB/C-TAB.

Michael



Re: [O] [RFC] Remove Org Struct mode

2017-08-21 Thread Michael Brand
Hi all

If I understand correctly orgstruct-mode has much more convenient key
bindings like TAB and its variants for cycling than outshine.el or
outline-minor-mode which is a big advantage for me. When point is on a
heading also the other key bindings are just the same as in Org mode.
This was my reason to give up outshine.el and to stick with headings
where orgstruct-mode does a good job and to not use lists.

If it is an option that someone reduces orgstruct-mode to only cycle
and navigate headings, without all the rest like for example heading
structure editing or lists, I would continue to use it instead of
outshine.el, outorg.el or even Org Babel for sometimes shared source
code files.

Michael



Re: [O] [RFC] Shrink columns dynamically

2017-07-11 Thread Michael Brand
Hi Nicolas

On Tue, Jul 11, 2017 at 1:47 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:

>> Also I hope that you can build in complete removal of columns for
>> export similar to as discussed around here:
>> http://lists.gnu.org/archive/html/emacs-orgmode/2016-04/msg00672.html

> Besides, was I supposed to implement it?

No.

> I cannot access the page right
> now, but IIRC, you suggested the idea, with a proof of concept. Then, we
> eventually ended up on some specifications.

Yes. To summarize the old thread, this is what I have since then in my
config file to use with | <#> |:

  (add-hook 'org-export-before-processing-hook
#'f-ox-filter-table-column-del)
  (defun f-ox-filter-table-column-del (back-end)
(while (re-search-forward "^[ \t]*|\\(.*|\\)? *\\(<#>\\) *|" nil t)
  (goto-char (match-beginning 2))
  (org-table-delete-column)
  (beginning-of-line)))

> I thought you would resume the work.

On my list it is still in someday/maybe, not likely to change. The
"problem" is that the above code is already enough.

Quoting from the old thread:

On Tue, Apr 26, 2016 at 10:56 PM, Michael Brand
<michael.ch.br...@gmail.com> wrote:

> On Tue, Apr 26, 2016 at 9:14 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> 
> wrote:

>> Does anyone feel like doing that?

> Let me see. If anyone wants to beat me please go ahead.

Michael



Re: [O] Deleting org table columns during export (Was: [RFC] Shrink columns dynamically)

2017-07-11 Thread Michael Brand
Hi Kaushal

On Tue, Jul 11, 2017 at 1:18 PM, Kaushal Modi <kaushal.m...@gmail.com> wrote:

> On Tue, Jul 11, 2017, 2:19 AM Michael Brand <michael.ch.br...@gmail.com>
> wrote:

>> Also I hope that you can build in complete removal of columns for
>> export similar to as discussed around here:
>> http://lists.gnu.org/archive/html/emacs-orgmode/2016-04/msg00672.html

> - If I understand correctly, Michael, you need to send a git
>   formatted patch of your proposal with documentation included?

No, I just hacked (summarized from the old thread)

  (add-hook 'org-export-before-processing-hook
#'f-ox-filter-table-column-del)
  (defun f-ox-filter-table-column-del (back-end)
(while (re-search-forward "^[ \t]*|\\(.*|\\)? *\\(<#>\\) *|" nil t)
  (goto-char (match-beginning 2))
  (org-table-delete-column)
  (beginning-of-line)))

in my config file to use with | <#> |. For all the tasks discussed in
the old thread I did not more than discuss. From my side there exists
nothing that can be made ready to be committed.

Michael



Re: [O] [RFC] Shrink columns dynamically

2017-07-11 Thread Michael Brand
Hi Nicolas

On Tue, Jul 11, 2017 at 12:11 AM, Kaushal Modi  wrote:

> The feature works nicely as explained, but please do not remove the width
> cookie!
>
> The new feature supports only completely hiding a column. But what we lose
> by removal of width cookie is:
>
> - Ability to truncate text in columns to a particular width (like 10) so
> that I can at least know what the content of that cell is about. And then to
> edit the cell, I would do C-c ` (org-table-edit-field). This is very useful
> for cells with verbose texts. That way, I can fit all the columns in a
> single screen width.
> - Also heavily missed will be retaining the narrowed/hidden state of the
> columns.

+1

Also I hope that you can build in complete removal of columns for
export similar to as discussed around here:
http://lists.gnu.org/archive/html/emacs-orgmode/2016-04/msg00672.html

Michael



Re: [O] org table toggle narrowing and true column hiding

2017-06-23 Thread Michael Brand
Hi Uwe

On Wed, Jun 21, 2017 at 11:24 AM, Uwe Brauer  wrote:

> Any plans to implement true column hiding for org tables?

Not that I know of. How would you select a hidden column to unhide it?

> Concerning narrowing (poor man version of hiding)
>
> | Name | passport | Other |
> |  | <2>  |   |
> | John Doe |  1234567 |   |

This is a good idea for your use case.

> The question is simple: how can a toggle narrowing?

To view all columns at once you can temporarily "C-c SPC C-c C-c" on
<2> and double undo.

To view only one field at a time and optionally edit it you can use
"C-c `" with zero, one or -- the coolest -- two C-u prefixes:

(info "(org) Built-in table editor")

`C-c ` (`org-table-edit-field')'
  Edit the current field in a separate window.  This is useful for
  fields that are not fully visible (*note Column width and
  alignment::).  When called with a `C-u' prefix, just make the full
  field visible, so that it can be edited in place.  When called
  with two `C-u' prefixes, make the editor window follow the cursor
  through the table and always show the current field.  The follow
  mode exits automatically when the cursor leaves the table, or when
  you repeat this command with `C-u C-u C-c `'.

Michael



Re: [O] empty cells in columns should be left emtpy when manipulating columns

2017-06-23 Thread Michael Brand
Hi Uwe

On Thu, Jun 22, 2017 at 9:56 AM, Uwe Brauer  wrote:

> #+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15;%.1f);E
>
> And friends did not work any more
>
> | 3.25 | 0.5) |
> |  | 0.0) |
> #+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15;%.1f);E

This is invalid syntax, what you meant would be:

| 3.25 | 0.5 |
|  | 0.0 |
#+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15);E %.1f

To preserve empty columns when reformatting you can use the Calc
formatter:

| 3.25 | 0.5 |
|  | |
#+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15);E f-1

(info "(org) Formula syntax for Calc")

`if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1'
  Sum of the first two columns.  When at least one of the input
  fields is empty the Org table result field is set to empty.  `E'
  is required to not convert empty fields to 0.  `f-1' is an
  optional Calc format string similar to `%.1f' but leaves empty
  results empty.

See also
"Which float format shows the fraction part also when the latter is
zero?"
http://orgmode.org/worg/org-faq.html#table-float-fraction

Michael



Re: [O] insert cell inside an org-mode table?

2017-06-08 Thread Michael Brand
Hi Sharon

On Thu, Jun 8, 2017 at 4:21 PM, Sharon Kimble
 wrote:

> Okay, imagine that you have this table -
>
> | fruit  | one| two|
> |++|
> | pear   | orange | grape  |
> | banana | grapefruit | satsuma|
> | tomato | potato | clementine |
>
> And you discover that you've missed out apples and you want to put them
> where 'grapefruit' currently is, I would like the following to happen -
>
> | fruit  | one| two|
> |++|
> | pear   | orange | grape  |
> | banana | apple  | satsuma|
> | tomato | grapefruit | clementine |
> || potato ||
>
> Where the rest of the column gets shifted downwards by one cell.
>
> Now that is a very simplistic table, the one that I'm hoping to build
> will be 6 columns by about 60 rows, so having the ability to shift rows
> downwards from inserting a cell would be vital to its successful usage.

This is not built-in but you can look here at the last example:
"Rearrange one or more field within the same row or column"
http://orgmode.org/worg/org-hacks.html#field-same-row-or-column

Michael



Re: [O] truncate-lines for org tables, visual-line-mode for rest?

2017-06-04 Thread Michael Brand
Hi all

On Mon, Jan 26, 2015 at 9:24 PM, Eric S Fraga  wrote:

> On Monday, 26 Jan 2015 at 21:43, Vladimir Alexiev wrote:

>> I use visual-line-mode to wrap long lines on display.
>> But for org tables, wrapping makes the display very confused.
>> Is it possible to have truncate-lines ONLY for lines that represent tables?

> I have the same issue.  I do have visual-line-mode bound to a key so I
> can toggle this on and off easily but it would definitely be nice if I
> didn't have to do anything...  however, I think it will be difficult to
> automate this.

Carsten made an Emacs feature request for this here
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5018

As I am also very interested in this I commented there now. Please
help me by showing your interest there too.

Michael



Re: [O] org-hide in terminal

2017-05-31 Thread Michael Brand
Hi Johannes

In a terminal with at least 16 colors the terminal color white (ID 7)
which is used for the face org-hide is darker than the terminal color
bright white (ID 15). Bright white is usually the same as the light
background. Use M-x list-colors-display in a terminal Emacs and look
at the first eight and the next eight colors, the bright variants of
the previous eight. For more about terminal colors see for example
http://en.wikipedia.org/wiki/ANSI_escape_code#Colors

To improve the situation of hiding the leading stars at least for
Emacs in a terminal with otherwise default color settings and with a
light background I started to use

  ;; For for example 256-color terminal and light background. The
  ;; Emacs color brightwhite is only defined on a terminal Emacs.
  (when (and (eq 'light (frame-parameter nil 'background-mode))
 (color-defined-p "brightwhite"))
(set-face-foreground 'org-hide "brightwhite"))

On macOS Terminal.app it does not work as good as on other operating
systems and terminals because there even bright white is darker than
the light background. Also take into account that on Terminal.app the
256 color IDs are mapped to only 16 instead of the usual 256 different
RGB values.

Michael



On Sat, Feb 11, 2017 at 3:12 PM, Johannes  wrote:

> Hello,
>
> With "org-hide-leading-stars" set to t orgmode tries to hide stars by
> using the "org-hide" face. This is documented with: "The foreground
> color of this face should be equal to the background
> color of the frame." and in the org manual in section Clean-view we find
> "Because Org makes the font color same as the background color to hide
> to stars, sometimes org-hide face may need tweaking to get the effect
> right. For some black and white combinations, grey90 on a white
> background might mask the stars better". As far as I can tell (which
> might be wront) it just assumes default colors "white" or "black", which
> might not be accurate.
>
> I think this is a bad solution for the following reasons.
>
> - It doesn't work well if emacs runs in a terminal (often the stars just
> get a grey background)
> - It shows the stars when we mark them (this might or might not be a
> good thing)
> - People who use the same config in multiple environments (other
> terminals and colors) will have to write some if-else code to get this
> right.
> - People who change their terminal colors get problems.
>
>
> Possible solutions I can think of are:
> a) Somhow make the existion solution work for terminals. I thought I
> could simply set org-hides forground to the backgrounf-value of the face
> "default", but somehow it didn't work out and I ended up with some sort
> of grey (which is not my background).
> b) emacs could have a text property, similar to "invisible", which hides
> text but still lets it occupy the space. I don't know how it work
> internaly, though. This is probably the best solution if the problem of
> hiding text occurs more often. I was told this was already discussed on
> emcas-devel, but I couldn't find it there.
> c) hide the leading stars behind spaces. I have a working prototype
> which works quite well. It uses "org-bullets" and "compose-region". It
> is not 100% clean though, since there still is a character which might
> be visible when using some minor mode.
>
> I am very new to emacs-lsip (and mailing lists) so I hope this is how it
> is done.
> Johannes Lippmann



Re: [O] Table formula references

2017-04-02 Thread Michael Brand
Hi Manuel

Not sure if I understand your formulas right, so check my solutions with
the formula debugger.

On Thu, Mar 30, 2017 at 10:38 AM, Manuel Schneckenreither
 wrote:

> So @5$3 should be 0.9^0*127 + 0.9^1*118 + 0.9^2*121 + 0.9^3*115.

Emacs Calc has map with anonymous function and one or more vectors for
the above:

vsum(map(<0.9^#1 * #2>, [3, 2, 1, 0], [115, 121, 118, 127]))

which equals

vsum(map(<0.9^(4 - #1) * #2>, [1, 2, 3, 4], [115, 121, 118, 127]))

The rest is Org spreadsheet. See the spreadsheet section in the Org
user manual to understand this solution:

| t | y_t | y_{t+1} |
|---+-+-|
| 1 | 115 | 115.000 |
| 2 | 121 | 224.500 |
| 3 | 118 | 320.050 |
| 4 | 127 | 415.045 |
#+TBLFM: $3 = vsum(map(<0.9^($1 - #1) * #2>, @I$1..@0$1, @I$2..@0$2)); f-3

The same with Emacs Lisp:

| t | y_t | y_{t+1} |
|---+-+-|
| 1 | 115 | 115.000 |
| 2 | 121 | 224.500 |
| 3 | 118 | 320.050 |
| 4 | 127 | 415.045 |
#+TBLFM: $3 = '(apply #'+ (cl-mapcar (lambda (tau y-tau) (* (expt 0.9
(- $1 tau)) y-tau)) '(@I$1..@0$1) '(@I$2..@0$2))); N %.3f

Michael



Re: [O] [RFC] Change visibility for bracket links

2016-10-13 Thread Michael Brand
Hi Nicolas

On Thu, Oct 13, 2016 at 2:35 PM, Nicolas Goaziou  wrote:
>
> Aaron Ecay  writes:
>
>> FWIW, I agree.  On the other hand, many people object to the brackets.
>
> I don't mind adding a variable.

Or maybe add new value(s) to org-descriptive-links to avoid yet
another defcustom and first of all to have it in that one variable
that when set to nil turns off any mechanism that hides anything in
links already?

Michael



Re: [O] working with tables can be quite painful...

2016-09-17 Thread Michael Brand
Hi Eric

Question, out of curiosity: Is there a difference when you delete all lines
above and below the table, with and without adding a headline above?

One of my tables fluctuates around 150 rows and around 20 to 40
columns, overall a few hundred characters wide (columns with some
history window for each row). Almost all fields are just text although
I think this doesn't matter at all. The table starts at about line 50
and is followed by about 7600 lines. Since years I manipulate it at
least every few days without any slowness, often on much weaker
hardware than yours.

Maybe you can find a temporary workaround.

Michael



Re: [O] How to use symbolic names to refer to spreadsheet fields containing irregular values

2016-08-04 Thread Michael Brand
Hi Christoph

On Wed, Aug 3, 2016 at 11:31 PM, Christoph LANGE
 wrote:

> I would like to make the following work (with Org 8.3.5):
>
> |---+--++---|
> |   |13:13 | -  | 1 |
> | ^ |h | s  | n |
> |---+--++---|
> |   | 13:13:00 | #ERROR | 1 |
> |---+--++---|
> #+TBLFM: @3$2=$h;T::@3$3=$s::@3$4=$n
>
> I can give the field @1$2 the symbolic name $h, I can give the field
> @1$4 the symbolic name $n, and I can successfully refer to both of them
> in @3.
>
> However I didn't manage to refer to @1$3 using the symbolic name $s.
> The reason must be the value "-".  If I use an alphabetic string value,
> it works.
>
> Any ideas?  Or is this a bug?
>
> Thank you very much in advance,

"-" is not a valid Calc expression. To copy literally one needs a Lisp
formula:

|---+--+---+---|
|   |13:13 | - | 1 |
| ^ |h | s | n |
|---+--+---+---|
|   | 13:13:00 | - | 1 |
|---+--+---+---|
#+TBLFM: @3$2 = $h; T :: @3$3 = '(identity "$s") :: @3$4 = $n

Michael



Re: [O] [BUG] External unicode links without a description in ox-html

2016-07-25 Thread Michael Brand
Hi Nicolas

Your suggestions are so convincing in going so far, I hope I
understand them right. If yes it is just thinking in terms of "[[",
"][" and "]]" instead of single brackets that I got used to with the
current escaping and unescaping in Org.

On Mon, Jul 25, 2016 at 2:52 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:

>> There seems to be a related issue with an inconsistency between HTML
>> and other export formats in using org-link-unescape for the link
>> _destination_ part: With the Org file
>>
>> 1) https://duckduckgo.com/?q=Org+mode+%252B+Worg
>> 2) https://duckduckgo.com/?q=Org+mode+%2B+Worg
>>
>> org-open-at-point on link 1) opens a web browser with the search field
>> filled with "Org mode + Worg" as expected by me.
>
> This looks like an error to me.
>
> If I type https://duckduckgo.com/?q=Org+mode+%252B+Worg in my browser,
> I get
>
>   "Org mode %2B Worg"
>
> as the search string. It should be the same when opening the link from
> an Org document. These URI are /not/ equivalent.
>
>> The same happens when using link 1) of the HTML export. But when
>> exporting to PDF (via LaTeX), ODT or ASCII (browse-url-at-point)
>> I have to use link 2) to get the same result. I think one should be
>> able to consistently use link 1) for all export formats.
>
> It looks as we're trying to paper over an Org problem here, which is the
> redundant link escaping that happens when calling `org-insert-link' (C-c
> C-l).
>
> AFAICT, there are two reasons for Org to escape a link: when the link
> contains either "]]" or multiple consecutive spaces. The former
> obviously breaks Org link syntax. The latter doesn't survive a call to
> `fill-paragraph'.
>
> Alas, Org handles it the wrong way, by using a mechanism that cannot be
> properly undone; you cannot possibly know how many times the desired URI
> has been encoded, if at all. Moreover, this mechanism isn't user
> friendly, i.e., you cannot reasonably ask a user to encode an URI on the
> fly when jolting notes.

I agree.

> I can see two ways out:
>
> 1. Do not escape anything.
>
>This prevent any link with a description to contain either "]]" or

... a single bracket at the border or a link destination part to
contain "][" or "]]" or a single bracket at the border or ...

>multiple spaces, but these requirements are so uncommon we probably
>shouldn't bother.

I never had such links and don't bother. If I am right these could
even be tweaked manually with %20, %5B and %5D to get working.

I can't tell for everyone but would happily adapt the escaped ones of
all my existing Org links accordingly if such a change happens in Org.

> 2. Use a different internal escape mechanism.
>
>By providing our own simple escape mechanism, e.g., \]\], we can
>solve the issues raised above.

In my opinion not necessary. Can be added later if really needed
anyway.

> In any case, Org should not create something as
>
>   https://duckduckgo.com/?q=Org+mode+%252B+Worg
>
> if the real URI is
>
>   https://duckduckgo.com/?q=Org+mode+%2B+Worg
>
> WDYT?

I agree.

Do I understand right that not escaping and unescaping would allow

:   https://duckduckgo.com/?q=[dest]dest
: [[https://duckduckgo.com/?q=[dest]dest]]
: [[https://duckduckgo.com/?q=[dest]dest][desc[desc]desc]]

etc. and even the same with link abbreviations instead of http(s)?

Michael



Re: [O] [BUG] External unicode links without a description in ox-html

2016-07-23 Thread Michael Brand
Hi Nicolas

There seems to be a related issue with an inconsistency between HTML
and other export formats in using org-link-unescape for the link
_destination_ part: With the Org file

1) https://duckduckgo.com/?q=Org+mode+%252B+Worg
2) https://duckduckgo.com/?q=Org+mode+%2B+Worg

org-open-at-point on link 1) opens a web browser with the search field
filled with "Org mode + Worg" as expected by me. The same happens when
using link 1) of the HTML export. But when exporting to PDF (via
LaTeX), ODT or ASCII (browse-url-at-point) I have to use link 2) to
get the same result. I think one should be able to consistently use
link 1) for all export formats.

Michael



Re: [O] Bug: Table formula does not copy time interval correctly [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.0.94/lisp/org/)]

2016-07-10 Thread Michael Brand
Hi Rares

On Fri, Jul 8, 2016 at 6:06 AM, Rares Vernica  wrote:

> Just to clarify, how would you fix this:
>
> | [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | vsum(d) |
> | [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | 2 d |
> #+TBLFM: $3=vsum(@1$-1..@0$-1)
>
> Notice the "vsum(d)" instead of the expected "1 d".

Depending on the number of fields in a range Org builds just a value
or a Calc vector of values. This is due to the comparison of r1/r2 and
c1/c2 which are the row and column beginning and end of the range in
the function org-table-get-range:

(if (and (not corners-only)
 (or (not rangep) (and (= r1 r2) (= c1 c2
;; Just one field.
[...]
  ;; A range, return a vector.
  [...])

I can not think of any use case where this should be more useful than
substituting ~(and (= r1 r2) (= c1 c2))~ with ~nil~. But since this
substitution could break existing usage I suggest to add ~vec~ to the
Calc formula:

| [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | d  | [d]  | d   |
| [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | [d, d] | [[d, d]] | 2 d |
#+TBLFM: $3 = @1$2..@0$2 :: $4 = vec(@1$2..@0$2) :: $5 = vsum(vec(@1$2..@0$2))

Michael



Re: [O] tables: sum columns only in certain ranges of rows

2016-07-07 Thread Michael Brand
Hi Uwe

On Mon, Jul 4, 2016 at 9:12 PM, Uwe Brauer  wrote:

> Is the a simple way to tell a org-table that
> it adds say two columns in a certain way $4=0.2*($2+$3)
> but only for certain values of the row. I hoped that
> a hline would help but it does not the row containing Taylor
> is treated in the same way as row 1 to 4.
>
>
> | Row | Name   | E1 | E2 | Res |
> |-++++-|
> |   1 | Smith  |  1 |  2 | 0.6 |
> |   2 | Miller |  2 |  1 | 0.6 |
> |   3 | Meyer  |  1 |  4 |  1. |
> |   4 | Wilson |  2 |  1 | 0.6 |
> |-++++-|
> |   5 | Taylor |  1 |  2 | 0.6 |
> |-++++-|
> #+TBLFM: $1=@#-1::$5=0.2*($3+$4)
>
>
> So what is the most comfortable to obtain what I want?

Depending on what you want you can use $5 = if($1 != 5, 0.2*($3+$4),
string("")). See also some other examples with if in the Org manual.

Michael



Re: [O] Bug: Table formula does not copy time interval correctly [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.0.94/lisp/org/)]

2016-07-07 Thread Michael Brand
Hi Rares

On Mon, Jul 4, 2016 at 6:28 PM, Rares Vernica  wrote:

> | [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | d   |
> | [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 2 d |
> #+TBLFM: $3=$2

A Calc formula interprets field values as a symbolic expressions to
calculate with. To copy literally one needs a Lisp formula:

| [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | 1d |
| [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 2d |
#+TBLFM: $3 = '(identity $2)

Michael



[O] bug#2409: bug#2409: 23.0.90; org-mode + viper-mode + ns make typing unresponsive

2016-05-17 Thread Michael Brand
Hi all

I did some trials in lisp/org/org.el with
- Emacs on OS X built with configure --with-ns, 24.5 and today's
  master
- Org from today's master

1) Removing the line containing org-self-insert-command from

   (org-remap org-mode-map
  'self-insert-command 'org-self-insert-command
  'delete-char 'org-delete-char
  'delete-backward-char 'org-delete-backward-char)

   lets the issue disappear. So the issue seems at least _related_ to
   org-self-insert-command.

2) When I instead remove all forms that contain
   org-self-insert-command or orgtbl-self-insert-command and then add

   ;; Reduce to a passing through to `self-insert-command'.
   (defun org-self-insert-command (N)
 (interactive "p")
 (self-insert-command N))
   ;; Leave this as it was originally.
   (org-remap org-mode-map
  'self-insert-command 'org-self-insert-command
  'delete-char 'org-delete-char
  'delete-backward-char 'org-delete-backward-char)

   the issue remains but I expect it to disappear. Did I not replace
   self-insert-command just with itself and it should behave the same
   way as with change 1)?

Michael





Re: [O] tables, comment in one line, export to html

2016-04-27 Thread Michael Brand
Hi Nicolas

I agree, together all the below makes sense. Some comments added.

Nicolas Goaziou  wrote:

> You are talking about section "3.5 The spreadsheet". I don't think this
> feature is directly related to spreadsheet capabilities.
>
> Actually, / in first column is described earlier in the manual, in "3.3
> Column groups". Besides, there is a similar feature described in "3.2
> Column width and alignment", about lines containing only alignment
> cookies:
>
>  Lines which only contain these formatting cookies will be removed
>   automatically when exporting the document.

<#> will have to be considered for removal of the line too.

> IMO, a better change would be to merge 3.2 and 3.3 as "Column
> operations" or some such, and add "<#>" as a way to ignore columns upon
> exporting. This way, everything related to columns is packed in the same
> subsection, and every column markup uses < or >. Moreover, there is no
> possible confusion with # markup from spreadsheet.
>
> WDYT?

> Another advantage about this is that there is no need for "/" in the
> first column, much like alignments cookies.

<#> will have to be fontified like <5> as org-formula (name and
description of the face are not precise) wich is the easiest part of
the change. Shouldn't < and > in a table be fontified too?

> It makes it simpler to ignore the first column.

Michael



Re: [O] tables, comment in one line, export to html

2016-04-26 Thread Michael Brand
Hi

On Tue, Apr 26, 2016 at 11:10 PM, Nicolas Goaziou
<m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:

>> # in non-first columns to mean noexport of the column has the
>> disadvantage of possible confusion with # in the first column where it
>> means special effect for recalculation when using the spreadsheet. As
>> I understand your first paragraph you want to avoid such confusion.
>
> I don't think there is a possible confusion if the manual makes it
> clear.
>
>> <#> I find a bit too near to <5>, <, > or <>.
>
> That was exactly the point, since those all apply to columns, unlike to
> rows special markers. IOW, so far, columns syntax systematically uses <
> or > (or both).
>
>> % or ; used for comments in LaTeX or Emacs Lisp I would find a good
>> space saving single character alternative. Why not % as this would not
>> be the first time that Org borrowed some syntax elements from LaTeX?
>
> Org comment syntax is related to #, not % or ;. I'd rather have similar
> things look similar.

To have similar things look similar and make it clear in the manual I
suggest to change the long existing

  ~/~
 Do not export this line.  Useful for lines that contain the
 narrowing `' markers or column group markers.

  Finally, just to whet your appetite [...]

to

  ~/~
 Do not export this row or column.  In the first column ~/~ means
 do not export this row which is useful for rows that contain the
 narrowing ~~ markers, column group markers or markers to not
 export a column.  In all other columns ~/~ means do not export
 this column if also the first column is marked with ~/~.  When
 the first column should not be exported move its content other
 than markers into an other column.

  When more than one marker is needed in a column put each in an own
  row with ~/~ in the first column.

  Finally, just to wet your appetite [...]

Michael



Re: [O] tables, comment in one line, export to html

2016-04-26 Thread Michael Brand
Hi

On Tue, Apr 26, 2016 at 9:14 PM, Nicolas Goaziou  wrote:

> It sounds good, as long as it is clear this markers is for export
> consumption only, and has no special effect when using the spreadsheet.
>
> I suggest to use # or <#> instead of / so as to refer to "comment" (but
> still use / as the marker for the first column).

# in non-first columns to mean noexport of the column has the
disadvantage of possible confusion with # in the first column where it
means special effect for recalculation when using the spreadsheet. As
I understand your first paragraph you want to avoid such confusion.

/ in non-first columns to mean noexport of the column as I did before
has the disadvantage of possible confusion with / in the first column
where it means noexport of the row.

<#> I find a bit too near to <5>, <, > or <>.

% or ; used for comments in LaTeX or Emacs Lisp I would find a good
space saving single character alternative. Why not % as this would not
be the first time that Org borrowed some syntax elements from LaTeX?
The glyph has also similarities to / that has a similar meaning.

> The removal could be done in a function like
> `org-export--delete-commented-rows' (see `org-export--delete-comments'
> in "ox.el").

And just to mention if someone wants to start: The non-greediness I
did before is not necessary and could be omitted for better
readability:
old: "^[ \t]*| +/ +|\\(.*?|\\)?? +\\(/\\) +|"
new: "^[ \t]*| +/ +|\\(.*|\\)? +\\(%\\) +|"

> This would also require documenting it in the manual and providing
> tests.

And a change note.

> Does anyone feel like doing that?

Let me see. If anyone wants to beat me please go ahead.

Michael



Re: [O] How to hide a table column from exporting

2016-04-26 Thread Michael Brand
Hi Kaushal

On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi  wrote:

> I was trying to prevent an org table column from exporting to html. So I
> started looking for a solution and found this:
> http://stackoverflow.com/q/6641379/1219634

Please see my answer for one solution in the thread "tables, comment
in one line, export to html" that started on 2016-04-19, e. g. at
http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683

Michael



Re: [O] tables, comment in one line, export to html

2016-04-26 Thread Michael Brand
Hi Uwe

On Tue, Apr 19, 2016 at 1:08 PM, Uwe Brauer  wrote:

> I would like to have a table entry in which the last colum contains
> comments which I don't want to export to html.
>
> Like this
>
> | Joe Smith  |  7 | 25 |  5 ||  37 |   | #+begin_comment from 
> group B B #+end_comment |
>
> But this does not work. So how can I achieve it?

I have the same need now and just hacked something simple together to
export

| / | /  ||  |
|   | 1n | 2y |  3y |

| / |  | /  ||
|   |  1y | 2n | 3y |

| /  |  | /  |
| 1y |  2y | 3n |

| / | /  | /  |  | /  | /  | /  |
|   | 1n | 2n |  3y | 4n | 5n | 6n |

| / |  |  |  |  |  |  |
| / |   / | /   |   / | |   / | /   |
|   |  1n | 2n  |  3n | 4y  |  5n | 6n  |

# Same result with a less useful notation:
| / |  |  |  |  |  |  |
| / |   / | /   | | |   / | /   |
| / | | /   |   / | | | |
|   |  1n | 2n  |  3n | 4y  |  5n | 6n  |

# Deletion must not get trapped with this:
| / |  |  |  |  |  |  |
| / | | | | | | |
|   |   / | /   |   / | | | |
|   |  1y | 2y  |  3y | 4y  |  5y | 6y  |

as e. g. ASCII to

:  2y  3y
:
:  1y  3y
:
:  1y  2y
:
:  3y
:
:  4y
:
:  4y
:
:   /  //
:  1y  2y  3y  4y  5y  6y

with

(add-hook 'org-export-before-processing-hook
  'f-ox-filter-table-column-del)
(defun f-ox-filter-table-column-del (back-end)
  "Delete the columns $2 to $> marked as \"/\" on a row with \"/\" in $1.
If you want a non-empty column $1 to be deleted make it $2 by
inserting an empty column before or rearrange column order in
some other way. Make sure \"/\" is in $1 again after that."
  (while (re-search-forward
  "^[ \t]*| +/ +|\\(.*?|\\)?? +\\(/\\) +|" nil t)
(goto-char (match-beginning 2))
(org-table-delete-column)
(beginning-of-line)))

Michael



Re: [O] Orgtbl: edit table like code, in a separate buffer?

2016-03-06 Thread Michael Brand
Hi Rafael

On Fri, Mar 4, 2016 at 6:17 PM, Rafael Ramirez Morales
 wrote:

> I was wondering if it was technically possible to invoke a separate buffer
> to edit a table in org mode.
>
> My working scenario is a table with several columns with limited width so as
> to edit a buffer with org-startup-indented on. I would like to achieve
> something like what is done with source blocks: upon invoking a command, the
> table would open in a separate buffer, with indent (i.e. visual
> line-wrapping) option off and that ignores column width limits.
>
> Is there any way to achieve this?

Not in the way that you describe. As a workaround you could
temporarily remove the narrowing cookies <10>. Take care of not
breaking a TBLFM when moving a whole row with all cookies out of the
table, in this case e. g. keep an empty row.

> Is there another way to go about this problem?

There is "C-u C-u C-c `" (`org-table-edit-field') to fully view and
optionally edit field by field one field at a time in a separate
window described in (info "(org) Built-in table editor").

Michael



Re: [O] Is it possible to keep /all/ the heading properties in one place?

2016-02-25 Thread Michael Brand
Hi Oleh

On Thu, Feb 25, 2016 at 11:59 AM, Oleh Krehel  wrote:

> - Tags - there are always a pain to re-align, they show up as diffs in
>   git commits

Did you consider to set org-tags-column to 0?

Or put the tags into your own property :MyTag: in the property drawer
instead of using Org's tags?

Michael



Re: [O] Auto-delete dated DONE notifications?

2016-02-23 Thread Michael Brand
Hi all

On Sat, Feb 20, 2016 at 2:00 PM, Nicolas Goaziou  wrote:

> I think this would be a nice addition to Org.

Yes, it has been the wish of several users including me earlier on
this list.

> We could add an option that can limit the number of state change
> notes in an entry.

My only "contribution" to this subject is to suggest to reuse the
existing option org-log-into-drawer and ":LOG_INTO_DRAWER:"
respectively and to extend its possible values.

Michael



Re: [O] Table calculation

2016-02-20 Thread Michael Brand
Hi Brett

On Sat, Feb 20, 2016 at 8:41 PM, Brett Presnell  wrote:

> In the following table, the last row gives the number of empty cells
> following the last nonempty cell in each column (except the first column
> of course).  I would like to create a TBLFM formula that does this
> calculation for me automatically.  Some time ago I tried using
> org-lookup-last and org-lookup-all for this, but I never got it to work.
> Any ideas/solutions?
>
> |   Date | AA | BB | CC | DD | EE | FF | GG | HH | II | JJ | KK | LL | MM |
> |+++++++++++++|
> |  / | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> |
> | 201005 |||||  1 |||  1 ||||  1 ||
> | 201008 ||||  1 ||||||||||
> | 201012 ||||||||||||||
> | 201105 ||||||  1 ||||||||
> | 201108 |||||||  1 |||||||
> | 201112 ||||||||||  1 ||||
> | 201205 ||||||||||||||
> | 201208 ||||||||||||||
> | 201212 |||||||||  1 |||||
> | 201305 |||  1 |||||  2 |||  1 |||
> | 201308 |  1 |||||||||||||
> | 201312 |||||||||||||  1 |
> | 201405 ||||||||  1 ||||  1 ||
> | 201408 ||  1 ||||||||||||
> | 201412 |||||  1 |||||||||
> | 201505 ||||  1 ||||||||||
> | 201508 |||||||||  1 |||||
> | 201512 |||||||  1 |||||||
> | 201605 ||||||||||||||
> |+++++++++++++|
> ||  8 |  5 |  9 |  3 |  4 | 15 |  1 |  6 |  2 | 13 |  9 |  6 |  7 |

Two of the possible solutions:

|   Date | AA | BB | CC | DD | EE | FF | GG | HH | II | JJ | KK | LL | MM |
|  / | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> |
|+++++++++++++|
| 201005 |||||  1 |||  1 ||||  1 ||
| 201008 ||||  1 ||||||||||
| 201012 ||||||||||||||
| 201105 ||||||  1 ||||||||
| 201108 |||||||  1 |||||||
| 201112 ||||||||||  1 ||||
| 201205 ||||||||||||||
| 201208 ||||||||||||||
| 201212 |||||||||  1 |||||
| 201305 |||  1 |||||  2 |||  1 |||
| 201308 |  1 |||||||||||||
| 201312 |||||||||||||  1 |
| 201405 ||||||||  1 ||||  1 ||
| 201408 ||  1 ||||||||||||
| 201412 |||||  1 |||||||||
| 201505 ||||  1 ||||||||||
| 201508 |||||||||  1 |||||
| 201512 |||||||  1 |||||||
| 201605 ||||||||||||||
|+++++++++++++|
||  8 |  5 |  9 |  3 |  4 | 15 |  1 |  6 |  2 | 13 |  9 |  6 |  7 |
#+TBLFM: @>$<<..@>$> = find(rev(@I..@II), 1) - 1; E

Note that I moved the header separator line.

When the last non-empty cell is not limited to be always 1 it gets a
bit more complicated:

#+TBLFM: @>$<<..@>$> = '(position-if-not (lambda (x) (equal x ""))
(reverse '(@I..@II))); E

Michael



Re: [O] Concatenation of cells using 'remote'

2016-02-15 Thread Michael Brand
Hi Loris

On Fri, Jan 29, 2016 at 2:20 PM, Loris Bennett
 wrote:
> Hi,
>
> I can create a concatenation of the element in column like this:
>
> #+NAME: addresses
> | able| a...@example.org |
> | baker   | ba...@example.org|
> | charlie | char...@example.org  |
> | | a...@example.org, ba...@example.org, char...@example.org |
> #+TBLFM: $2='(concat $1 "@example.org")
> #+TBLFM: @4$2='(mapconcat 'identity (list @1$2..@3$2) ", ")
>
> I tried the following to create the concatenation in a
> separate table:
>
> | #ERROR |
> #+TBLFM: $1='(mapconcat 'identity '(list remote(addresses,@1$2..@3$2) ", ")
>
> but this doesn't work.  Presumably the expansion of the range happens at
> the wrong time.
>
> Does anyone know how to do this properly?

Just typos:

| a...@example.org, ba...@example.org, char...@example.org |
#+TBLFM: $1='(mapconcat 'identity (list remote(addresses,@1$2..@3$2)) ", ")

Michael



Re: [O] column view uses non-existent org-whitespace face

2016-02-08 Thread Michael Brand
Hi Eric

On Thu, Sep 25, 2014 at 6:09 PM, Michael Brand
<michael.ch.br...@gmail.com> wrote:

> On Tue, Aug 5, 2014 at 4:53 AM, Eric Abrahamsen <e...@ericabrahamsen.net> 
> wrote:

>> 2. The text for %ITEM has the face org-whitespace applied to the leading
>> stars, which doesn't exist anymore. I assume the intended effect was
>> that the stars take up space, emulating indentation, but not themselves
>> be visible. I guess that would be done by replacing the org-whitespace
>> face with whatever's being used as the column background color but I
>> don't know enough about faces to make that work. I also tried switching
>> 'org-whitespace to 'invisible, but that didn't do anything. This is in
>> org-columns-cleanup-item.
>>
>> [...]
>> The second would be nice to resolve --
>> it's ugly!
>
> Same here. I just tried to hide the leading stars in column view by
> shifting the beginning of the overlay to the right in
> `org-columns-new-overlay' with
>
> (let ((ov (make-overlay
>(if org-hide-leading-stars (+ beg (org-current-level) -1) beg)
>end)))
>
> but this trial seems to have several issues and I don't know how to do
> it right.
>
> Michael

With recent changes made by Nicolas the solution became obvious to me,
fixed in master. (I don't consider hidden stars useful in column view
of agenda view as it is not a folded hierarchy and as the headings can
origin from different settings for hidden stars, so I didn't repeat my
change there.)

Michael



Re: [O] org-player and switch to lexical binding in org.el

2016-02-07 Thread Michael Brand
Hi Paul

On Thu, Jan 28, 2016 at 4:00 AM, Paul Sexton  wrote:

> Hi, I have just pushed the suggested change to the org-player repository on
> bitbucket. Please let me know if it has fixed the problem.

org-player.el 1.0.1 plays again for links with a position. For links
without position there is a change missing, see my attached patch as a
suggestion.

Michael
--- org-player.1.0.1.el	2016-01-29 21:32:18.0 +0100
+++ org-player.1.0.2.el	2016-02-06 09:27:14.0 +0100
@@ -2,7 +2,7 @@
 ;;; org-player.el - Play audio and video files in org-mode hyperlinks
 ;;;
 ;;; Author: Paul Sexton 
-;;; Version: 1.0.1
+;;; Version: 1.0.2
 ;;; Repository at http://bitbucket.org/eeeickythump/org-player/
 ;;;
 ;;;
@@ -102,7 +102,7 @@
 
 (add-to-list 'org-file-apps
  (cons (concat org-player-file-extensions-regexp "$")
-   '(org-player-play-file file)))
+   (lambda (file link) (org-player-play-file file
 
 (add-to-list 'org-file-apps
  (cons (concat org-player-file-extensions-regexp


Re: [O] org-pdfview-open doesn't work anymore

2016-02-07 Thread Michael Brand
Hi Nicolas

On Sat, Feb 6, 2016 at 5:41 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> IMO, notifying user that there's something rotten in the state of
> `org-file-apps' is enough. There's no need to go into the gory details
> of the problem.

I agree and finally found what I was missing: Add `debug' to the
handler of `condition-case' to finally not disable support of further
investigation with `toggle-debug-on-error'. It obsoletes my trials to
provide enough context about the Lisp error in the handler itself.
Remixed patch for review attached.

Michael
From 96aa89840c15c71c534faa0ce265530d5ff88c0a Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.br...@alumni.ethz.ch>
Date: Sun, 7 Feb 2016 11:07:56 +0100
Subject: [PATCH] `org-file-apps' add migration hint for function signature

* lisp/org.el (org-open-file): Add a user error for when the function
signature does not match.
---
 lisp/org.el | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index cce4f3a..e77fd4a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11325,15 +11325,22 @@ If the file does not exist, an error is thrown."
  ((functionp cmd)
   (save-match-data
 	(set-match-data link-match-data)
-	(funcall cmd file link)))
+	(condition-case nil
+	(funcall cmd file link)
+	  ;; FIXME: Remove this check when most default installations
+	  ;; of Emacs have at least Org 9.0.
+	  ((debug wrong-number-of-arguments wrong-type-argument
+	invalid-function)
+	   (user-error "Please see Org News for version 9.0 about \
+`org-file-apps'--Lisp error: %S" cmd)
  ((consp cmd)
   ;; FIXME: Remove this check when most default installations of
   ;; Emacs have at least Org 9.0.
   ;; Heads-up instead of silently fall back to
   ;; `org-link-frame-setup' for an old usage of `org-file-apps'
   ;; with sexp instead of a function for `cmd'.
-  (user-error
-   "Please see Org News for version 9.0 about `org-file-apps'"))
+  (user-error "Please see Org News for version 9.0 about \
+`org-file-apps'--Error: Deprecated usage of %S" cmd))
  (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
 (and (derived-mode-p 'org-mode)
 	 (eq old-mode 'org-mode)
-- 
2.4.9 (Apple Git-60)



Re: [O] org-pdfview-open doesn't work anymore

2016-02-06 Thread Michael Brand
Hi Nicolas

On Fri, Feb 5, 2016 at 11:43 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:

>> + ;; FIXME: Remove this check when most default installations of
>> + ;; Emacs have at least Org 9.0.
>> + ((wrong-number-of-arguments invalid-function)
>> +  (user-error
>> +   (concat
>> +"Please see Org News for version 9.0 about `org-file-apps', "
>> +"error: "
>> +(prin1-to-string err))
>
> (user-error
>  "Please see Org News for version 9.0 about `org-file-apps', error: %S"
>  (nth 1 err))

The above does not provide (nth 0 err) which is the important error
type and (nth 2 err) which I find also helpful. See following zerop
examples.

What am I missing that it should not be

((wrong-number-of-arguments wrong-type-argument invalid-function)
 (user-error "Please see Org News for version 9.0 about \
`org-file-apps'--Lisp error: %S" err))

to get

Please see Org News for version 9.0 about \
`org-file-apps'--Lisp error: (wrong-number-of-arguments zerop 2)

Please see Org News for version 9.0 about \
`org-file-apps'--Lisp error: (wrong-type-argument numberp nil)

from

(condition-case err (zerop nil nil) ...)

(condition-case err (zerop nil) ...)

to mimic

Debugger entered--Lisp error: (wrong-number-of-arguments zerop 2)

Debugger entered--Lisp error: (wrong-type-argument numberp nil)

from

(zerop nil nil)

(zerop nil)

as far as possible?

I just notice that in our case at least in case of wrong-type-argument the
`cmd' is missing, so I suggest

((wrong-number-of-arguments wrong-type-argument invalid-function)
 (user-error "Please see Org News for version 9.0 about \
`org-file-apps'--Lisp error: The function %S leads to %S" cmd err))

for the attached intermediate patch version. For the above example of
(zerop nil) it would not only report "wrong-type-argument" and
"numberp" together with "nil" but also "zerop" which in our case is
the registered application, the source of the problem where the user
needs to look.

Michael
From 873e99c9ee03594e45dd3e82d880c4b8a90d2192 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.br...@alumni.ethz.ch>
Date: Sat, 6 Feb 2016 09:03:17 +0100
Subject: [PATCH] `org-file-apps' add migration hint for function signature

* lisp/org.el (org-open-file): Add an error for when the function
signature does not match.
---
 lisp/org.el | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index cce4f3a..cacae0f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11325,15 +11325,21 @@ If the file does not exist, an error is thrown."
  ((functionp cmd)
   (save-match-data
 	(set-match-data link-match-data)
-	(funcall cmd file link)))
+	(condition-case err
+	(funcall cmd file link)
+	  ;; FIXME: Remove this check when most default installations
+	  ;; of Emacs have at least Org 9.0.
+	  ((wrong-number-of-arguments wrong-type-argument invalid-function)
+	   (user-error "Please see Org News for version 9.0 about \
+`org-file-apps'--Lisp error: The function %S leads to %S" cmd err)
  ((consp cmd)
   ;; FIXME: Remove this check when most default installations of
   ;; Emacs have at least Org 9.0.
   ;; Heads-up instead of silently fall back to
   ;; `org-link-frame-setup' for an old usage of `org-file-apps'
   ;; with sexp instead of a function for `cmd'.
-  (user-error
-   "Please see Org News for version 9.0 about `org-file-apps'"))
+  (user-error "Please see Org News for version 9.0 about \
+`org-file-apps'--error: Deprecated usage of %S" cmd))
  (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
 (and (derived-mode-p 'org-mode)
 	 (eq old-mode 'org-mode)
-- 
2.4.9 (Apple Git-60)



Re: [O] Columnview *** is exported as *

2016-02-06 Thread Michael Brand
Hi Nicolas

On Sat, Feb 6, 2016 at 12:07 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:

>> --
>> ITEM  |
>> * Column view |
>> *** Subsect.. |
>> * Subsu.. |
>> * File config :ARCHIVE:...
>> --
>
> Fixed. Thank you.

Confirmed. Thank you.

Michael



Re: [O] org-pdfview-open doesn't work anymore

2016-02-05 Thread Michael Brand
Hi Julien

On Fri, Feb 5, 2016 at 6:46 AM, Julien Cubizolles  wrote:
> I've been using org-pdfview (from
> https://github.com/markus1189/org-pdfview) to have org-mode open pdf
> files generated during export.
>
> --8<---cut here---start->8---
> (pdf-tools-install)
> (eval-after-load 'org '(progn (require 'org-pdfview)
>   (add-to-list 'org-file-apps '("\\.pdf\\'" . 
> org-pdfview-open))
>   ))
> --8<---cut here---end--->8---
>
> Since a recent upgrade, this fails with:
>
> --8<---cut here---start->8---
> (wrong-number-of-arguments #[(link) "\304\305 \"\2031\306\307 \"\310\306\311 
> \"!\310\306\312 \"!\313\307\"\210\314
> !\210\315\316 \317 @_\320 \245!!+\207\304\321 \"\203N\306\307 \"\310\306\311 
> \"!\313\307\"\210\314
> !*\207\313 \307\"\207" [link path page height string-match 
> "\\(.*\\)::\\([0-9]*\\)\\+\\+\\([[0-9]\\.*[0-9]*\\)" match-string 1 
> string-to-number 2 3 org-open-file pdf-view-goto-page 
> image-set-window-vscroll round pdf-view-image-size frame-char-height 
> "\\(.*\\)::\\([0-9]+\\)$"] 4 
> ("/home/wilk/.emacs.d/elpa/org-pdfview-20160125.1254/org-pdfview.elc" . 662)] 
> 2)
>   
> org-pdfview-open("/home/wilk/enseignement/2015-2016/topos/topo-tipe-beamer.pdf"
>  "/home/wilk/enseignement/2015-2016/topos/topo-tipe-beamer.pdf")
> --8<---cut here---end--->8---
>
> Is it a bug in Org-mode or should I report the issue to the org-pdfview
> author ?

Due to lexical binding in org.el there was a change in
`org-file-apps', see Org News for version 9.0 and e. g. this thread:
http://thread.gmane.org/gmane.emacs.orgmode/104272
I think the most convenient would be if `org-open-file' tries to find
out that `cmd' in this case is a function with only one argument and
call it with just `file'.

@Nicolas: Is this reasonable for you to implement?

Michael



Re: [O] org-pdfview-open doesn't work anymore

2016-02-05 Thread Michael Brand
Hi Nicolas

On Fri, Feb 5, 2016 at 6:22 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:

>> +  ;; FIXME: Remove this check when most default installations of
>> +  ;; Emacs have at least Org 9.0.
>> +  (let ((arglist (help-function-arglist cmd)))
>> + (when (or (memq ' arglist)
>> +   (memq ' arglist)
>> +   (/= 2 (length arglist)))
>> +   (user-error
>> +(format
>> + "%s%s%S"
>> + "Please see Org News for version 9.0 about `org-file-apps', "
>> + "this function signature is wrong: "
>> + cmd
>
> I have the feeling there is some over-engineering involved there.

Also it should have allowed at least optional arguments

(when (or (memq
   ;; Too complicated to parse regarding that such functions
   ;; are probably not useful here.
   '
   arglist)
  (/= 2 (length (delete ' arglist
  (user-error

for e. g. a simple

(add-to-list 'org-file-apps
 (cons (concat org-player-file-extensions-regexp "$")
   'org-player-play-file))

which refers to the existing

(defun org-player-play-file (filename  pos)

> In any case, instead of relying on `help-function-arglist', I suggest to
> use something lightweight:
>
> (condition-case err
> (funcall ...)
>   (wrong-number-of-arguments
>(user-error "Please ..."))
>   (invalid-function
>(user-error "Please ...")))

Of course. I didn't know about this possibility, remixed patch attached.

Michael
From f1c382cabe5b34f52db22df70d5c25e02de2a18a Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.br...@gmail.com>
Date: Fri, 5 Feb 2016 19:42:55 +0100
Subject: [PATCH] `org-file-apps' add migration hint for function signature

* lisp/org.el (org-open-file): Add an error when the function
signature does not match.
---
 lisp/org.el | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d4fb8a6..f6c5f89 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11323,9 +11323,18 @@ If the file does not exist, an error is thrown."
 		  (when (derived-mode-p 'org-mode) (org-reveal)))
 	(search (org-link-search search
  ((functionp cmd)
-  (save-match-data
-	(set-match-data link-match-data)
-	(funcall cmd file link)))
+  (condition-case err
+	  (save-match-data
+	(set-match-data link-match-data)
+	(funcall cmd file link))
+	;; FIXME: Remove this check when most default installations of
+	;; Emacs have at least Org 9.0.
+	((wrong-number-of-arguments invalid-function)
+	 (user-error
+	  (concat
+	   "Please see Org News for version 9.0 about `org-file-apps', "
+	   "error: "
+	   (prin1-to-string err))
  ((consp cmd)
   ;; FIXME: Remove this check when most default installations of
   ;; Emacs have at least Org 9.0.
@@ -11333,7 +11342,9 @@ If the file does not exist, an error is thrown."
   ;; `org-link-frame-setup' for an old usage of `org-file-apps'
   ;; with sexp instead of a function for `cmd'.
   (user-error
-   "Please see Org News for version 9.0 about `org-file-apps'"))
+   (concat "Please see Org News for version 9.0 about `org-file-apps', "
+	   "error: deprecated usage of "
+	   (prin1-to-string cmd
  (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
 (and (derived-mode-p 'org-mode)
 	 (eq old-mode 'org-mode)
-- 
2.1.3.dirty



Re: [O] Columnview *** is exported as *

2016-02-05 Thread Michael Brand
Hi Nicolas

Commit release_8.3.3-547-g00f0c70 does not respect the stars of ITEM
any more for the dynamic column width of the interactive column view
with overlays. The fix of org-columns-get-autowidth-alist for the two
"(setq-local org-columns-current-maxwidths [...]" seems too
complicated to do it myself.

The MCE

--
* Column view
*** Subsection
* Subsubsection
* File config :ARCHIVE:
  #+COLUMNS: %ITEM
  #+STARTUP: odd showall
--

changes the looking from

--
ITEM|
* Column view   |
*** Subsection  |
* Subsubsection |
* File config :ARCHIVE:...
--

to

--
ITEM  |
* Column view |
*** Subsect.. |
* Subsu.. |
* File config :ARCHIVE:...
--

Michael



Re: [O] org-pdfview-open doesn't work anymore

2016-02-05 Thread Michael Brand
Hi Nicolas

On Fri, Feb 5, 2016 at 9:33 AM, Michael Brand
<michael.ch.br...@gmail.com> wrote:

> Due to lexical binding in org.el there was a change in
> `org-file-apps', see Org News for version 9.0 and e. g. this thread:
> http://thread.gmane.org/gmane.emacs.orgmode/104272
> I think the most convenient would be if `org-open-file' tries to find
> out that `cmd' in this case is a function with only one argument and
> call it with just `file'.

Only after a closer look I saw that the single parameter of
`org-pdfview-open' is not `file' but `link'. It is probably better for
`org-open-file' to not guess in case of `cmd' with a single parameter
whether it is meant to be `file' or `link'. That leads me to suggest
the attached patch to be reviewed that checks the function signature.

Michael
From 9788cb03d2714cde555fbe2abb55ddd383a885c1 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.br...@gmail.com>
Date: Fri, 5 Feb 2016 14:44:26 +0100
Subject: [PATCH] `org-file-apps' add migration hint for function signature

* lisp/org.el (org-open-file): Add an error when the function
signature does not match.
---
 lisp/org.el | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5a6c74e..9ebabf8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11323,6 +11323,18 @@ If the file does not exist, an error is thrown."
 		  (when (derived-mode-p 'org-mode) (org-reveal)))
 	(search (org-link-search search
  ((functionp cmd)
+  ;; FIXME: Remove this check when most default installations of
+  ;; Emacs have at least Org 9.0.
+  (let ((arglist (help-function-arglist cmd)))
+	(when (or (memq ' arglist)
+		  (memq ' arglist)
+		  (/= 2 (length arglist)))
+	  (user-error
+	   (format
+	"%s%s%S"
+	"Please see Org News for version 9.0 about `org-file-apps', "
+	"this function signature is wrong: "
+	cmd
   (save-match-data
 	(set-match-data link-match-data)
 	(funcall cmd file link)))
@@ -11333,7 +11345,10 @@ If the file does not exist, an error is thrown."
   ;; `org-link-frame-setup' for an old usage of `org-file-apps'
   ;; with sexp instead of a function for `cmd'.
   (user-error
-   "Please see Org News for version 9.0 about `org-file-apps'"))
+   (format "%s%s%S"
+	   "Please see Org News for version 9.0 about `org-file-apps', "
+	   "this usage is wrong: "
+	   cmd)))
  (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
 (and (derived-mode-p 'org-mode)
 	 (eq old-mode 'org-mode)
-- 
2.1.3.dirty



Re: [O] org-player and switch to lexical binding in org.el

2016-02-04 Thread Michael Brand
Hi Nicolas

On Thu, Feb 4, 2016 at 9:36 AM, Nicolas Goaziou  wrote:

> I do not mind, as there is an explicit "FIXME" or "XXX" somewhere above
> reminding us to remove this at some point.

My concern is only the version 9.1 which I find too early. A FIXME in
my sense is added to the attached patch, please rephrase if necessary.

Michael


0001-org-file-apps-add-migration-hint.patch
Description: Binary data


Re: [O] org-player and switch to lexical binding in org.el

2016-02-03 Thread Michael Brand
Hi Nicolas and Paul

On Wed, Feb 3, 2016 at 6:33 PM, Nicolas Goaziou  wrote:

> I replaced S-expressions with functions of two arguments. The Org world
> is a better place with one less `eval'.

Just to confirm: Updating org-player.el to 1.0.1 makes Org links to
media files play again. Thank you both for your changes.

I made some thoughts about the user experience of this incompatible
change:

Following such an Org link after updating Org without taking too much
care of `org-file-apps' or as a new Org user silently falls back to
open the file e. g. directly in an Emacs buffer just as with a default
`org-file-apps'. In this situation a user may well not be aware of
that `org-file-apps' has fallen short of an application registered
there. Or, even if I read the Org News I might not be aware of all the
additions to `org-file-apps' I got under the hood. Or the user does
not read the Org News or does not understand the consequences to its
very end.

For all this I suggest a simple migration hint like the error in my
attached patch. Did I miss its disadvantage?

Michael


0001-org-file-apps-add-migration-hint.patch
Description: Binary data


Re: [O] org-player and switch to lexical binding in org.el

2016-02-03 Thread Michael Brand
Hi Nicolas

On Wed, Feb 3, 2016 at 9:56 PM, Nicolas Goaziou  wrote:

> I have no objection, but I suggest to add a big fat FIXME above so as to
> remove it once we release Org 9.1.

I would prefer to keep it much longer for those who do not regularly
update Org. The many cases when Org 9.0 is not part of the update
path. E. g. when a distro will include Emacs 25.1 with Org 8.3.3 (?)
in some time and a user will start with Org of this distro when it has
already some age and again some time later he will update to Org from
master and a compatible Emacs. I guess that more than a few distros
will skip Org 9.0 and more than a few distro users will also skip some
update steps of their distro.

> Also, it should be `user-error', not `error'.

Intermediate patch version attached.

Michael


0001-org-file-apps-add-migration-hint.patch
Description: Binary data


Re: [O] org-player and switch to lexical binding in org.el

2016-01-31 Thread Michael Brand
Hi Nicolas and Paul

On Sun, Jan 31, 2016 at 12:30 AM, Nicolas Goaziou
<m...@nicolasgoaziou.fr> wrote:

> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>> Only slowly I begin to get it partially. My observation is that if the
>> current `org-open-file' would be changed to
>>
>> (eval cmd
>>   ;; LEXICAL argument.
>>   `((file . ,(convert-standard-filename file))
>> (link . ,dlink)))
>
> Actually, that should be (eval cmd t). Providing an alist is not
> necessary here.
>
>> to provide also the `link' symbol then a
>>
>> (add-to-list 'org-file-apps
>>  (cons (concat org-player-file-extensions-regexp
>>"::\\([0-9]+:[0-9]+\\(:[0-9]+\\)?\\)")
>>'(org-player-play-file file (match-string 1 link
>>
>> which is simple enough for me to understand in org-player.el works.
>> This situation looks favorable to me at least for a first step because
>> it would mean a version of org-player.el that remains compatible with
>> "any" Org before lexical binding in org.el
>> (release_8.3.3-426-g1f49e9f) but would also become compatible again
>> starting with one of the next commits in Org master.
>>
>> Do I understand correct that this would not break any backward
>> compatibility with all other existing and correct use of
>> `org-file-apps'?
>
> Although it does the job, it would leave an `eval' in the code base,
> which is not very pretty, and more difficult to maintain (scope is less
> obvious). That's why I prefer the functions. Of course, it may not be
> worth the trouble if introduced backward incompatibility is really
> nasty.

I see the pros and cons of either solution with a slight bias to not
break backward compatibility and am OK with what you and others
decide.

(Corrigenda: In my code examples earlier in this thread I should have
used `link' instead of `dlink' which is ~(downcase link)~.)

Michael



Re: [O] org-player and switch to lexical binding in org.el

2016-01-29 Thread Michael Brand
Hi Nicolas

On Fri, Jan 29, 2016 at 2:32 PM, Nicolas Goaziou  wrote:
> My suggestion was hypothetical, and not yet implemented. No wonder it
> doesn't work.
>
> If you think this change sounds reasonable, I can implement it, tho.
> However, there is some backward incompatibility involved.
>
> The current solution, i.e., using `eval' only provides `file' symbol.

Only slowly I begin to get it partially. My observation is that if the
current `org-open-file' would be changed to

(eval cmd
  ;; LEXICAL argument.
  `((file . ,(convert-standard-filename file))
(link . ,dlink)))

to provide also the `link' symbol then a

(add-to-list 'org-file-apps
 (cons (concat org-player-file-extensions-regexp
   "::\\([0-9]+:[0-9]+\\(:[0-9]+\\)?\\)")
   '(org-player-play-file file (match-string 1 link

which is simple enough for me to understand in org-player.el works.
This situation looks favorable to me at least for a first step because
it would mean a version of org-player.el that remains compatible with
"any" Org before lexical binding in org.el
(release_8.3.3-426-g1f49e9f) but would also become compatible again
starting with one of the next commits in Org master.

Do I understand correct that this would not break any backward
compatibility with all other existing and correct use of
`org-file-apps'?

On Sun, Jan 17, 2016 at 9:40 PM, Nicolas Goaziou  wrote:
> I don't like the current solution either (eval with a LEXICAL argument).
>
> I think it would be better to use un function with two arguments (file
> and link-string instead). This is not backward compatible, but the
> change is trivial: sexp -> (lambda (file link) sexp).

I am concerned about backward compatibility and don't understand the
lambda part enough: Would backward compatibility be broken only for
org-player.el or also for other existing and correct use of
`org-file-apps'?

Or can `org-open-file' support both for some time like this?:

(if (eq (car cmd) 'lambda)
;; Function.
(funcall cmd (convert-standard-filename file) dlink)
  ;; Sexp, deprecated.
  (eval cmd `((file . ,(convert-standard-filename file))
  (link . ,dlink

Michael



Re: [O] org-player and switch to lexical binding in org.el

2016-01-28 Thread Michael Brand
Hi Nicolas

On Sun, Jan 17, 2016 at 9:40 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> Hello,
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>> release_8.3.3-426-g1f49e9f introduces a regression. The link
>>
>> [[file:/dir/audio.mp3::0:12:34]]
>>
>> results in
>>
>> Debugger entered--Lisp error: (void-variable search)
>>   (org-player-play-file file search)
>>   [...]
>>   org-open-file("/dir/audio.mp3" nil nil "0:12:34")
>>   [...]
>
> `search' never was advertised as a dynamically scoped variable in
> `org-file-apps' docstring, so "org-player" is just playing with fire
> here.
>
> I don't like the current solution either (eval with a LEXICAL argument).
>
> I think it would be better to use un function with two arguments (file
> and link-string instead). This is not backward compatible, but the
> change is trivial: sexp -> (lambda (file link) sexp).
>
> In the current case, you need to use match string:
>
>   (add-to-list 'org-file-apps
>(cons (concat org-player-file-extensions-regexp
>  "::\\([0-9]+:[0-9]+\\(:[0-9]+\\)?\\)")
>  (lambda (file link)
>(org-player-play-file file (match-string 1 link)
>
> WDYT?

I am still not able to get your suggestion that Paul has implemented
in the meantime in org-player.el 1.0.1 to work. Now I am trying to
understand what I am missing with the lambda.

Has the (eval cmd) in org-open-file to be extended somehow to the
variant (funcall cmd) as lambda evaluates to itself?

Michael



Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-25 Thread Michael Brand
Hi Karl

> I tried to reference "the item one row up" via @@#-1$1 (and similar)
> and failed. Is there a way to accomplish this as well?

It fails because @@#-1$1 is only substituted with @1-1$1, @2-1$1 etc.
depending on the row it is evaluated on.

To be able to use an expression as the index for an indirection one
can select the element from a Calc vector or Lisp list. For a Calc
formula example please e. g. look for the Calc function subscr() in
http://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas

Beware of the formula modifier E to keep empty fields counting for the
position:

| 1 | |   |
|---+-+---|
| 2 |   1 | 1 |
|   |   2 | 2 |
| 4 | nan | 4 |
#+TBLFM: $2 = subscr(@<$1..@>$1, @# - 1); E :: $3 = subscr(@<$1..@>$1, @# - 1)

| 1st | | |
|-+-+-|
| 2nd | 1st | 1st |
| | 2nd | 2nd |
| 4th | | 4th |
#+TBLFM: $2 = '(nth (- @# 2) '(@<$1..@>$1)); E :: $3 = '(nth (- @# 2)
'(@<$1..@>$1))

>>> [1] 
>>> https://github.com/novoid/org-mode-workshop/blob/master/featureshow/org-mode-teaser.org#1131-referencing-example-with-detailed-explanation
>>
>> Do you remember that some time ago I reminded you about a patch that I
>> had sent you privately to align your above URL with the change about how
>> to copy fields in the Org manual?
>
> A big sorry from my side: I did not process your email for too many
> months. Thanks for contributing to my tutorial!

Thank you for applying my patch for the section "column-based".

Attached is another patch for the section "row-based" which I somehow
missed in the first place.

The sentence "the identity statement prevents calc from interpreting
the content" that you added might be misleading because the formula is
now a Lisp formula '(func ...), with a mandatory function in its first
place and Calc is not involved.

Btw. I failed to find a Calc formula as capable as the Lisp formula to
copy content one to one. Some time ago I documented my trials into
this direction in test-org-table/copy-field in
testing/lisp/test-org-table.el.

Michael
diff --git a/featureshow/org-mode-teaser.org b/featureshow/org-mode-teaser.org
index 1d4305a..0d949ca 100644
--- a/featureshow/org-mode-teaser.org
+++ b/featureshow/org-mode-teaser.org
@@ -735,24 +735,24 @@ The formular can be simplified even more by using a 
column formula:
 
 #+NAME: comparison-table-horizontal
 |  |  Joe | Alice |  Bob |  sum |
-| 2012 Income June |   10 |24 |   17 |   51 |
+| Income June 2012 |   10 |24 |   17 |   51 |
 | plus 20 percent  | 12.0 |  28.8 | 20.4 | 60.0 |
 | June 2013|   11 |31 |   21 |  |
 | Difference   | -1.0 |   2.2 |  0.6 |  1.8 |
-#+TBLFM: @>$>=vsum(@5$2..@5$4)::@1$2..@1$4=remote(Income2012h, 
@1$$#)::@2=remote(Income2012h, @3$$#)::@3$2..@3$4=1.2 * remote(Income2012h, 
@3$$#);%.1f::@5$2..@5$4=@4-@3;%.1f
+#+TBLFM: @>$>=vsum(@5$2..@5$4)::@1$2..@1$4='(identity remote(Income2012h, 
@1$$#))::@2='(identity remote(Income2012h, @3$$#))::@3$2..@3$4=1.2 * 
remote(Income2012h, @3$$#);%.1f::@5$2..@5$4=@4-@3;%.1f
 
 - all formulas explained in detail:
   - ~@>$>=vsum(@5$2..@5$4)~
 - value: ~1.8~
 - last column in last row (~@>$>~) is the vector-sum (~vsum~) of
   column two to four of fifth row (~@5$2..@5$4~)
-  - ~@1$2..@1$4=remote(Income2012h, @1$$#)~
+  - ~@1$2..@1$4='(identity remote(Income2012h, @1$$#))~
 - values: ~Joe | Alice |  Bob |  sum~
 - column two to four of first row (~@1$2..@1$4~) are copied from
   the corresponding fields of the first row (~@1$$#~) of table
   "Income2012h"
 - see also 
[[http://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas][Org-hacks]]
 for field formulas
-  - ~@2=remote(Income2012h, @3$$#)~
+  - ~@2='(identity remote(Income2012h, @3$$#))~
 - values: ~2012 Income June |   10 |24 |   17 |   51~
 - the second row (~@2~) is copied from the corresponding fields of
   the first row (~@1$$#~) of table "Income2012h"


Re: [O] Tables: remote reference fails with umlaut (and in other cases)

2016-01-19 Thread Michael Brand
Hi Karl

On Tue, Jan 19, 2016 at 4:29 PM, Karl Voit  wrote:

> I never understood the @@#-syntax anyway. On [1] I referenced to [2].

Please see the Org manual for @# and $#. Thus @@#$1 is substituted
with @1$1, @2$1, @3$1 etc. depending on the row it is evaluated on.
@1$$# becomes @1$1, @1$2 etc.

> [1] 
> https://github.com/novoid/org-mode-workshop/blob/master/featureshow/org-mode-teaser.org#1131-referencing-example-with-detailed-explanation

Do you remember that some time ago I reminded you about a patch that I
had sent you privately to align your above URL with the change about how
to copy fields in the Org manual?

Michael



Re: [O] isearch-forward at end of entry

2016-01-18 Thread Michael Brand
Hi Kyle

On Mon, Jan 18, 2016 at 4:33 AM, Kyle Meyer <k...@kyleam.com> wrote:
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>> With today's release_8.3.2-441-ga87dea3 on Emacs 24.5 and this org
>> file
>>
>> 
>> * d
>>   - e
>>   - f
>> * g
>> 
>>
>> when d is folded: After "M-< C-s f RET" the entry d is folded but I
>> expect it to remain unfolded like after "M-< C-s e RET". Am I doing
>> something wrong?
>
> I'm not able to reproduce this with the commit you mentioned or with the
> current master (531985d).  Are you still seeing this issue?

Yes. I retried with a few more, all with

cd /git/org-mode
git checkout [...]
make cleanall info uncompiled
emacs -Q -L /git/org-mode/lisp

on OS X "GNU Emacs 24.5.1 (x86_64-apple-darwin14.3.0, NS
apple-appkit-1347.57)" and on GNU/Linux "GNU Emacs 24.5.1
(x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)". They are all not
ok:

- release_7.9.4-0-g107f921
- release_8.0-0-g7248fb1
- release_8.3.2-441-ga87dea
- release_8.3.3-444-g531985
- release_8.3.3-465-g0f8c6b

Michael



Re: [O] isearch-forward at end of entry

2016-01-18 Thread Michael Brand
Hi Kyle

On Mon, Jan 18, 2016 at 8:06 PM, Kyle Meyer  wrote:
>
> I was failing to produce this with an Emacs 25.0.50 build on GNU/Linux.
> I tried with Emacs 24.5.1, and I see the same issue as you.  So
> presumably a commit in Emacs 25 fixes this, but I haven't looked into
> which commit this is.

Interesting. Thank you that you have clarified this.

Michael



Re: [O] org-player and switch to lexical binding in org.el

2016-01-17 Thread Michael Brand
Hi Paul

It seems that this is beyond of my knowledge and I would like to ask
you as the author of org-player for help.


On Sun, Jan 17, 2016 at 9:40 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> Hello,
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>> release_8.3.3-426-g1f49e9f introduces a regression. The link
>>
>> [[file:/dir/audio.mp3::0:12:34]]
>>
>> results in
>>
>> Debugger entered--Lisp error: (void-variable search)
>>   (org-player-play-file file search)
>>   [...]
>>   org-open-file("/dir/audio.mp3" nil nil "0:12:34")
>>   [...]
>
> `search' never was advertised as a dynamically scoped variable in
> `org-file-apps' docstring, so "org-player" is just playing with fire
> here.
>
> I don't like the current solution either (eval with a LEXICAL argument).
>
> I think it would be better to use un function with two arguments (file
> and link-string instead). This is not backward compatible, but the
> change is trivial: sexp -> (lambda (file link) sexp).
>
> In the current case, you need to use match string:
>
>   (add-to-list 'org-file-apps
>(cons (concat org-player-file-extensions-regexp
>  "::\\([0-9]+:[0-9]+\\(:[0-9]+\\)?\\)")
>  (lambda (file link)
>(org-player-play-file file (match-string 1 link)
>
> WDYT?
>
>
> Regards,
>
> --
> Nicolas Goaziou

Michael



[O] org-player and switch to lexical binding in org.el

2016-01-17 Thread Michael Brand
Hi all

release_8.3.3-426-g1f49e9f introduces a regression. The link

[[file:/dir/audio.mp3::0:12:34]]

results in

Debugger entered--Lisp error: (void-variable search)
  (org-player-play-file file search)
  [...]
  org-open-file("/dir/audio.mp3" nil nil "0:12:34")
  [...]

I hope it is reproducible after (require 'org-player), org-player.el
attached.

Michael


org-player.el
Description: Binary data


Re: [O] org-player and switch to lexical binding in org.el

2016-01-17 Thread Michael Brand
Hi Paul

It seems that this is beyond of my knowledge and I would like to ask
you as the author of org-player for help.

On Sun, Jan 17, 2016 at 9:40 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> Hello,
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>> release_8.3.3-426-g1f49e9f introduces a regression. The link
>>
>> [[file:/dir/audio.mp3::0:12:34]]
>>
>> results in
>>
>> Debugger entered--Lisp error: (void-variable search)
>>   (org-player-play-file file search)
>>   [...]
>>   org-open-file("/dir/audio.mp3" nil nil "0:12:34")
>>   [...]
>
> `search' never was advertised as a dynamically scoped variable in
> `org-file-apps' docstring, so "org-player" is just playing with fire
> here.
>
> I don't like the current solution either (eval with a LEXICAL argument).
>
> I think it would be better to use un function with two arguments (file
> and link-string instead). This is not backward compatible, but the
> change is trivial: sexp -> (lambda (file link) sexp).
>
> In the current case, you need to use match string:
>
>   (add-to-list 'org-file-apps
>(cons (concat org-player-file-extensions-regexp
>  "::\\([0-9]+:[0-9]+\\(:[0-9]+\\)?\\)")
>  (lambda (file link)
>(org-player-play-file file (match-string 1 link)
>
> WDYT?
>
>
> Regards,
>
> --
> Nicolas Goaziou

Michael



Re: [O] Org campture recursively expands %-escapes

2016-01-12 Thread Michael Brand
Hi Nicolas

On Tue, Jan 12, 2016 at 9:42 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
> > I don't understand because the org-time-stamp-formats you mention is
> > already used and does not cover inactive timestamps.
>
> I'm talking about the function, not the variable.

Now I found it: The name of the function you mention is not
`org-time-stamp-formats' but
`org-time-stamp-format' without the "s" at the end.

I pushed my change, thank you for your help.

Michael



Re: [O] Org campture recursively expands %-escapes

2016-01-11 Thread Michael Brand
Hi Nicolas

On Tue, Jan 12, 2016 at 12:05 AM, Nicolas Goaziou
<m...@nicolasgoaziou.fr> wrote:
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
>>  (ert-deftest test-org-capture/fill-template ()
>> -  "Test `org-capture-fill-template' specifications."
>> +  "Test `org-capture-fill-template' specifications.
>> +The tests here are very similar to those in
>> +`test-org-feed/fill-template'."
>
> Not sure the last sentence above is really interesting. Ditto for the
> other occurrences.

Maybe this and vice versa is better?:

(ert-deftest test-org-capture/fill-template ()
  "Test `org-capture-fill-template' specifications."

  ;; When working on these tests consider to also change
  ;; `test-org-feed/fill-template'.

  ;; %(sexp) placeholder.
  (should
  [...]

>> -   (string-match-p
>> -(format-time-string (substring (car org-time-stamp-formats) 1 -1))
>> +   (equal
>> +(concat "[" (format-time-string
>> +  (substring (car org-time-stamp-formats) 1 -1)) "]\n")
>>  (org-capture-fill-template "%u")))
>>(should
>> -   (string-match-p
>> -(format-time-string (substring (cdr org-time-stamp-formats) 1 -1))
>> +   (equal
>> +(concat "[" (format-time-string
>> +  (substring (cdr org-time-stamp-formats) 1 -1)) "]\n")
>
> I discovered recently (!) `org-time-stamp-formats' which avoids doing
> the substring dance. You may want to use it instead. Ditto for the other
> occurrences.

I don't understand because the org-time-stamp-formats you mention is
already used and does not cover inactive timestamps.

Michael



Re: [O] Org campture recursively expands %-escapes

2016-01-10 Thread Michael Brand
Hi Nicolas

On Sat, Jan 9, 2016 at 6:54 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
> > My current ERT for test-org-feed.el
> >
> >(equal
> > "5 % Less (See\n Item \"3)\" Somewhere)"
> > (org-feed-format-entry
> >  '(:title "5 % less (see\n item \"3)\" somewhere)")
> >  "%(capitalize \"%h\")" nil))
> >
> > works now too. What does not work yet is my backport of the above ERT
> > to test-org-capture.el:
> >
> >(equal
> > "5 % Less (See\n Item \"3)\" Somewhere)\n"
> > (let ((org-store-link-plist nil))
> >   (org-capture-fill-template
> >"%(capitalize \"%i\")"
> >"5 % less (see\n item \"3)\" somewhere)")))
> >
> > Am I doing something wrong?
>
> I think you're mis-using "%i" place-holder. One feature is to repeat the
> leading text, so that, when you write, for example "> %i", "> " is
> repeated every line.

Indeed. After removing the "\n" from the input of the capture ERT it
works too.

I would like to push the attached change to add some ERTs with the
commit msg below and would like to ask you for a review first.

Michael



Add ERTs for feed templates

* testing/lisp/test-org-capture.el (test-org-capture/fill-template):
  Strengthen some expectations, add new tests.

* testing/lisp/test-org-feed.el: New file derived from
  testing/lisp/test-org-capture.el.
diff --git a/testing/lisp/test-org-capture.el b/testing/lisp/test-org-capture.el
index 714309d..e1011d0 100644
--- a/testing/lisp/test-org-capture.el
+++ b/testing/lisp/test-org-capture.el
@@ -26,7 +26,9 @@
 (require 'org-capture)
 
 (ert-deftest test-org-capture/fill-template ()
-  "Test `org-capture-fill-template' specifications."
+  "Test `org-capture-fill-template' specifications.
+The tests here are very similar to those in
+`test-org-feed/fill-template'."
   ;; %(sexp) placeholder.
   (should
(equal "success!\n"
@@ -44,12 +46,14 @@
  (org-capture-fill-template "%T")))
   ;; %u and %U placeholders.
   (should
-   (string-match-p
-(format-time-string (substring (car org-time-stamp-formats) 1 -1))
+   (equal
+(concat "[" (format-time-string
+(substring (car org-time-stamp-formats) 1 -1)) "]\n")
 (org-capture-fill-template "%u")))
   (should
-   (string-match-p
-(format-time-string (substring (cdr org-time-stamp-formats) 1 -1))
+   (equal
+(concat "[" (format-time-string
+(substring (cdr org-time-stamp-formats) 1 -1)) "]\n")
 (org-capture-fill-template "%U")))
   ;; %i placeholder.  Make sure sexp placeholders are not expanded
   ;; when they are inserted through this one.
@@ -57,11 +61,12 @@
(equal "success!\n"
  (let ((org-store-link-plist nil))
(org-capture-fill-template "%i" "success!"
-  (should-not
-   (equal "failure!\n"
+  (should
+   (equal "%(concat \"no \" \"evaluation\")\n"
  (let ((org-store-link-plist nil))
-   (org-capture-fill-template "%i" "%(concat \"failure\" \"!\")"
-  ;; Test %-escaping with / character.
+   (org-capture-fill-template
+"%i" "%(concat \"no \" \"evaluation\")"
+  ;; Test %-escaping with \ character.
   (should
(equal "%i\n"
  (let ((org-store-link-plist nil))
@@ -73,7 +78,21 @@
   (should
(equal "\\%i\n"
  (let ((org-store-link-plist nil))
-   (org-capture-fill-template "\\%i" "success!")
+   (org-capture-fill-template "\\%i" "success!"
+  ;; More than one placeholder in the same template.
+  (should
+   (equal "success! success! success! success!\n"
+ (let ((org-store-link-plist nil))
+   (org-capture-fill-template "%i %i %i %i" "success!"
+  ;; %(sexp) placeholder with an input containing the traps %, " and )
+  ;; all at once which is complicated to parse.
+  (should
+   (equal
+"5 % Less (See Item \"3)\" Somewhere)\n"
+(let ((org-store-link-plist nil))
+  (org-capture-fill-template
+   "%(capitalize \"%i\")"
+   "5 % less (see item \"3)\" somewhere)")
 
 
 
diff --git a/testing/lisp/test-org-feed.el b/testing/lisp/test-org-feed.el
index e69de29..6696f95 100644
--- a/testing/lisp/test-org-feed.el
+++ b/testing/lis

Re: [O] Org campture recursively expands %-escapes

2016-01-09 Thread Michael Brand
Hi Nicolas

On Sat, Jan 9, 2016 at 5:05 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:
>
> Michael Brand <michael.ch.br...@gmail.com> writes:
>
> > On the other hand commit release_8.3.3-415-ge2fbaee breaks the ERT
> > that I suggested in this thread or its simplification here:
> >
> >   (progn
> > (require 'org-feed)
> > (equal "\"A)" (org-feed-format-entry
> >'(:title "\"a)") "%(capitalize \"%h\")" nil)))
>
> Hopefully, this is now fixed in master.

It is, thank you. Incredibly fast 11 minutes from my report to your
commit!

My current ERT for test-org-feed.el

   (equal
"5 % Less (See\n Item \"3)\" Somewhere)"
(org-feed-format-entry
 '(:title "5 % less (see\n item \"3)\" somewhere)")
 "%(capitalize \"%h\")" nil))

works now too. What does not work yet is my backport of the above ERT
to test-org-capture.el:

   (equal
"5 % Less (See\n Item \"3)\" Somewhere)\n"
(let ((org-store-link-plist nil))
  (org-capture-fill-template
   "%(capitalize \"%i\")"
   "5 % less (see\n item \"3)\" somewhere)")))

Am I doing something wrong?

Michael


  1   2   3   4   5   6   7   >