Re: [O] [PATCH] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Richard Hansen
On 2015-09-19 04:16, Nicolas Goaziou wrote:
> Hello,
> 
> Richard Hansen  writes:
> 
>> * lisp/org.el (org--setup-collect-keywords): cd to the directory
>> containing the SETUPFILE before recursing so that relative pathnames
>> in the SETUPFILE are expanded properly.
>>
>> * lisp/ox.el (org-export--get-inbuffer-options): cd to the directory
>> containing the SETUPFILE before recursing so that relative pathnames
>> in the SETUPFILE are expanded properly.
>>
>> If /path/to/foo.org contains:
>>
>> #+SETUPFILE: settings/beamer.org
>>
>> and /path/to/settings/beamer.org contains:
>>
>> #+SETUPFILE: common.org
>>
>> then we want to read /path/to/settings/common.org, not
>> /path/to/common.org.
>>
>> TINYCHANGE
> 
> Thank you.
> 
> Could you also provide add a test for it in "test-org.el"
> (test-org/set-regexps-and-options)?

I'm having trouble running the test suite.  'make test' freezes at:

  test-ob-shell/dont-insert-spaces-on-expanded-bodies

If I comment out that test, it hangs at:

  test-ob-shell/dont-error-on-empty-results

If I comment out that test, it gets stuck at:

  test-ob-python/colnames-yes-header-argument-again

I haven't yet tried commenting out that test because I feel like I'm
doing something wrong.  Any hints?  (Emacs 24.4.1 from Ubuntu 15.04)

Thanks,
Richard



Re: [O] [PATCH v2] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Kyle Meyer
Richard Hansen  writes:

> Should I use cd-absolute instead of setting default-directory
> directly?  It does some sanity checks (among other things) that seem
> worthwhile.

Looking at these checks, I don't think they are useful in this context,
and some change the intended behavior.

* One check makes sure the directory ends in a slash, but this will
  already be the case because your changes call file-name-directory.

* Another calls expand-file-name, but all these functions already expand
  the original file name upstream.

* Another signals an error if the directory doesn't exist, is not a
  directory, or isn't accessible.  All but one of these functions call
  org-file-contents with a non-nil NOERROR, so the intent is to message
  rather than raise an error when a file doesn't exist.
  (org--setup-collect-keywords is the one function that doesn't use
  org-file-contents, but it does check that the file is readable before
  calling insert-file-contents.)

--
Kyle



[O] [PATCH v3] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Richard Hansen
* lisp/org-macro.el (org-macro--collect-macros): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/org.el (org--setup-collect-keywords): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/ox.el (org-export--get-inbuffer-options,
org-export--list-bound-variables): cd to the directory containing the
SETUPFILE before recursing so that relative pathnames in the SETUPFILE
are expanded properly.

If /path/to/foo.org contains:

#+SETUPFILE: settings/beamer.org

and /path/to/settings/beamer.org contains:

#+SETUPFILE: common.org

then we want to read /path/to/settings/common.org, not
/path/to/common.org.

TINYCHANGE
---
Patch changelog:
  v3: use (setq default-directory ...) instead of (cd ...)
  v2: fix a couple more cases; add some tests

 lisp/org-macro.el  | 2 ++
 lisp/org.el| 1 +
 lisp/ox.el | 4 
 testing/examples/setupfile.org | 7 +--
 testing/examples/setupfile3.org| 6 ++
 testing/examples/subdir/setupfile2.org | 1 +
 6 files changed, 15 insertions(+), 6 deletions(-)
 create mode 100644 testing/examples/setupfile3.org
 create mode 100644 testing/examples/subdir/setupfile2.org

diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 65795f6..e808972 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -106,6 +106,8 @@ Return an alist containing all macro templates found."
  (org-remove-double-quotes val
   (unless (member file files)
 (with-temp-buffer
+  (setq default-directory
+(file-name-directory file))
   (org-mode)
   (insert (org-file-contents file 'noerror))
   (setq templates
diff --git a/lisp/org.el b/lisp/org.el
index 74fe4ae..bd5a183 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5194,6 +5194,7 @@ Return value contains the following keys: `archive', 
`category',
(org-remove-double-quotes value)
   (when (and f (file-readable-p f) (not (member f files)))
 (with-temp-buffer
+  (setq default-directory (file-name-directory f))
   (insert-file-contents f)
   (setq alist
 ;; Fake Org mode to benefit from cache
diff --git a/lisp/ox.el b/lisp/ox.el
index bfdfeba..477fc06 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1455,6 +1455,8 @@ Assume buffer is in Org mode.  Narrowing, if any, is 
ignored."
 ;; Avoid circular dependencies.
 (unless (member file files)
   (with-temp-buffer
+(setq default-directory
+  (file-name-directory file))
 (insert (org-file-contents file 'noerror))
 (let ((org-inhibit-startup t)) (org-mode))
 (setq plist (funcall get-options
@@ -1586,6 +1588,8 @@ an alist where associations are (VARIABLE-NAME VALUE)."
(org-remove-double-quotes val
 (unless (member file files)
   (with-temp-buffer
+(setq default-directory
+  (file-name-directory file))
 (let ((org-inhibit-startup t)) (org-mode))
 (insert (org-file-contents file 'noerror))
 (setq alist
diff --git a/testing/examples/setupfile.org b/testing/examples/setupfile.org
index a85dbc0..71acfca 100644
--- a/testing/examples/setupfile.org
+++ b/testing/examples/setupfile.org
@@ -1,6 +1 @@
-#+BIND: variable value
-#+DESCRIPTION: l2
-#+LANGUAGE: en
-#+SELECT_TAGS: b
-#+TITLE: b
-#+PROPERTY: a 1
+#+SETUPFILE: subdir/setupfile2.org
diff --git a/testing/examples/setupfile3.org b/testing/examples/setupfile3.org
new file mode 100644
index 000..a85dbc0
--- /dev/null
+++ b/testing/examples/setupfile3.org
@@ -0,0 +1,6 @@
+#+BIND: variable value
+#+DESCRIPTION: l2
+#+LANGUAGE: en
+#+SELECT_TAGS: b
+#+TITLE: b
+#+PROPERTY: a 1
diff --git a/testing/examples/subdir/setupfile2.org 
b/testing/examples/subdir/setupfile2.org
new file mode 100644
index 000..31586fa
--- /dev/null
+++ b/testing/examples/subdir/setupfile2.org
@@ -0,0 +1 @@
+#+SETUPFILE: ../setupfile3.org
-- 
2.5.3




Re: [O] A book produced using Org

2015-09-19 Thread Vikas Rawal
> 
> Beautiful! I would love to see the org file! How did emacs perform which such 
> huge file?
> 

Emacs had no trouble whatsoever. The main file is 9313 lines. 

I turned off evaluation of code blocks at export time. Many of the code blocks 
download data from FAO and other websites before using them. Evaluating all of 
them at export time would have meant too much lag in producing the pdf. So all 
code blocks had to be manually evaluated (C-c C-c), if I changed anything.

I did not manage to learn and use export filters. There were a couple of things 
that I needed to fix at the time of export. Since I could not handle those in 
org, I wrote a bash script that would use sed to clear up those things, and 
then create a pdf. But that was it.

Although I do not know git very well, I can manage basic operations. I had a 
git repo to deal with versions. In the end, there were two versions: one that 
laid out the page on a larger stock paper with trim marks for the printer, and 
another that generated the online version for the FAO document repository.

Let me put the files in a github repo and share the link.

Vikas










[O] Rescheduling timestamps on a headline (not the next line)

2015-09-19 Thread Michael Hoffman
I am using org-mode 8.2.10. I often like to keep SCHEDULED and DEADLINE 
timestamps on the headline so they are more compact and show up even 
when I have collapsed that tree. Unfortunately, in this case, 
(org-schedule) and (org-deadline) add a new timestamp on the second line 
instead of replacing the previous schedule.


Steps to reproduce:

1. Visit new file `test.org`
2. Enter `* Task SCHEDULED: <2015-09-19>` in the buffer
3. C-c C-s for (org-schedule)
4. S-right to select 2015-09-20
5. RET

Output:

* Task SCHEDULED: <2015-09-19>
  SCHEDULED: <2015-09-20 Sun>

What I expected:

* Task SCHEDULED: <2015-09-20 Sun>

Is there a way to get my expected output? (org-add-planning-info) seems 
to go to the end of the headline:


(org-back-to-heading t)
(looking-at (concat org-outline-regexp "\\( *\\)[^\r\n]*"))
(goto-char (match-end 1))
(setq col (current-column))
(goto-char (match-end 0))

Before it starts looking for text to replace.

Many thanks,
Michael




[O] [PATCH v2] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Richard Hansen
* lisp/org-macro.el (org-macro--collect-macros): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/org.el (org--setup-collect-keywords): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/ox.el (org-export--get-inbuffer-options,
org-export--list-bound-variables): cd to the directory containing the
SETUPFILE before recursing so that relative pathnames in the SETUPFILE
are expanded properly.

If /path/to/foo.org contains:

#+SETUPFILE: settings/beamer.org

and /path/to/settings/beamer.org contains:

#+SETUPFILE: common.org

then we want to read /path/to/settings/common.org, not
/path/to/common.org.

TINYCHANGE
---
 lisp/org-macro.el  | 1 +
 lisp/org.el| 1 +
 lisp/ox.el | 2 ++
 testing/examples/setupfile.org | 7 +--
 testing/examples/setupfile3.org| 6 ++
 testing/examples/subdir/setupfile2.org | 1 +
 6 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100644 testing/examples/setupfile3.org
 create mode 100644 testing/examples/subdir/setupfile2.org

diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 65795f6..741c42c 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -106,6 +106,7 @@ Return an alist containing all macro templates found."
  (org-remove-double-quotes val
   (unless (member file files)
 (with-temp-buffer
+  (cd (file-name-directory file))
   (org-mode)
   (insert (org-file-contents file 'noerror))
   (setq templates
diff --git a/lisp/org.el b/lisp/org.el
index 74fe4ae..ded3e13 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5194,6 +5194,7 @@ Return value contains the following keys: `archive', 
`category',
(org-remove-double-quotes value)
   (when (and f (file-readable-p f) (not (member f files)))
 (with-temp-buffer
+  (cd (file-name-directory f))
   (insert-file-contents f)
   (setq alist
 ;; Fake Org mode to benefit from cache
diff --git a/lisp/ox.el b/lisp/ox.el
index bfdfeba..31e93e3 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1455,6 +1455,7 @@ Assume buffer is in Org mode.  Narrowing, if any, is 
ignored."
 ;; Avoid circular dependencies.
 (unless (member file files)
   (with-temp-buffer
+(cd (file-name-directory file))
 (insert (org-file-contents file 'noerror))
 (let ((org-inhibit-startup t)) (org-mode))
 (setq plist (funcall get-options
@@ -1586,6 +1587,7 @@ an alist where associations are (VARIABLE-NAME VALUE)."
(org-remove-double-quotes val
 (unless (member file files)
   (with-temp-buffer
+(cd (file-name-directory file))
 (let ((org-inhibit-startup t)) (org-mode))
 (insert (org-file-contents file 'noerror))
 (setq alist
diff --git a/testing/examples/setupfile.org b/testing/examples/setupfile.org
index a85dbc0..71acfca 100644
--- a/testing/examples/setupfile.org
+++ b/testing/examples/setupfile.org
@@ -1,6 +1 @@
-#+BIND: variable value
-#+DESCRIPTION: l2
-#+LANGUAGE: en
-#+SELECT_TAGS: b
-#+TITLE: b
-#+PROPERTY: a 1
+#+SETUPFILE: subdir/setupfile2.org
diff --git a/testing/examples/setupfile3.org b/testing/examples/setupfile3.org
new file mode 100644
index 000..a85dbc0
--- /dev/null
+++ b/testing/examples/setupfile3.org
@@ -0,0 +1,6 @@
+#+BIND: variable value
+#+DESCRIPTION: l2
+#+LANGUAGE: en
+#+SELECT_TAGS: b
+#+TITLE: b
+#+PROPERTY: a 1
diff --git a/testing/examples/subdir/setupfile2.org 
b/testing/examples/subdir/setupfile2.org
new file mode 100644
index 000..31586fa
--- /dev/null
+++ b/testing/examples/subdir/setupfile2.org
@@ -0,0 +1 @@
+#+SETUPFILE: ../setupfile3.org
-- 
2.5.3




Re: [O] A book produced using Org

2015-09-19 Thread Fabrice Popineau
I won't be long : very nice job !

Fabrice

2015-09-20 0:26 GMT+02:00 Vikas Rawal :

> I am happy to share with fellow Orgers my recent book —  Ending
> Malnutrition: from commitment to action  — published by the Food and
> Agriculture Organisation of the United Nations, Rome and Tulika Books, New
> Delhi (http://www.fao.org/3/a-i4921e.pdf),  The book was written and
> produced entirely in Org.
>
> This would not have been possible without the terrific support provided by
> this community. Over the last few months, I have come to this mailing list
> with several queries about how to do something or the other, and people
> have very patiently provided solutions and suggestions.
>
> I would like to thank everyone for their patience and their support.
>
> Vikas
>
> 
>
> From acknowledgements of the book:
>
> In addition, for all the statistical work and writing, the authors relied
> on R ([[http://www.r-project.org][www.r-project.org]]), org ([[
> http://www.orgmode.org][www.orgmode.org]]),
> and LaTeX. All three are open source projects, freely made available by
> very vibrant communities of developers. During the course of the work, we
> often drew on support from these communities.
>
>


-- 
Fabrice Popineau
-
SUPELEC
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
--


Re: [O] A book produced using Org

2015-09-19 Thread Thomas S . Dye
Aloha Vikas,

Looks great.  Congratulations!

All the best,
Tom

Vikas Rawal  writes:

> I am happy to share with fellow Orgers my recent book —  Ending Malnutrition: 
> from commitment to action  — published by the Food and Agriculture 
> Organisation of the United Nations, Rome and Tulika Books, New Delhi 
> (http://www.fao.org/3/a-i4921e.pdf ),  The 
> book was written and produced entirely in Org.
>
> This would not have been possible without the terrific support provided by 
> this community. Over the last few months, I have come to this mailing list 
> with several queries about how to do something or the other, and people have 
> very patiently provided solutions and suggestions. 
>
> I would like to thank everyone for their patience and their support.
>
> Vikas
>
> 
>
> From acknowledgements of the book:
>
> In addition, for all the statistical work and writing, the authors relied on 
> R ([[http://www.r-project.org][www.r-project.org]]), org 
> ([[http://www.orgmode.org][www.orgmode.org]]),
> and LaTeX. All three are open source projects, freely made available by very 
> vibrant communities of developers. During the course of the work, we often 
> drew on support from these communities.

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] [PATCH v2] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Kyle Meyer
Richard Hansen  writes:

>(with-temp-buffer
> +(cd (file-name-directory file))
>  (org-mode)
>  (insert (org-file-contents file 'noerror))

Why not just set default-directory instead of calling cd?  Does it make
sense to support CDPATH here?

--
Kyle



Re: [O] [PATCH v2] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Richard Hansen
On 2015-09-19 18:43, Kyle Meyer wrote:
> Richard Hansen  writes:
> 
>>   (with-temp-buffer
>> +   (cd (file-name-directory file))
>> (org-mode)
>> (insert (org-file-contents file 'noerror))
> 
> Why not just set default-directory instead of calling cd?  Does it make
> sense to support CDPATH here?

I wasn't aware of CDPATH and its interaction with cd.  Should I use
cd-absolute instead of setting default-directory directly?  It does some
sanity checks (among other things) that seem worthwhile.

Thanks,
Richard



Re: [O] A book produced using Org

2015-09-19 Thread Vikas Rawal

> On 20-Sep-2015, at 4:20 am, Pascal Fleury  wrote:
> 
> Great! Congrats!
> 
> I was actually wondering: you are 3 authors. How did you collaborate, in 
> practice ? There was a thread about using org for collaborative work, but it 
> seemed to end in discussing other tools...
> Was it plain git/emacs and the tools used usually for code management ?


Well, unfortunately, the other two authors are not familiar with emacs, 
org-mode, or LaTeX.

The parts they wrote were sent as MS-Word files. I converted them into Org-mode.

For the parts I wrote, I sent them PDFs. The first time, I also sent them a 
Word version. I offered them that they could comment in word (with track 
changes) and send me, or better still, work on hard copies and send me the 
scans. The PDFs were so far superior to those word files, that could not resist 
them :). So, their comments came as scans of the commented hard copies, and I 
incorporated them in. Once they were comfortable with this, in subsequent 
rounds, I had to send them only PDFs.

We followed the same process with the copy editors. The copy editors worked on 
hard copies, and I incorporated the comments. This actually had a huge 
advantage since, in the process of incorporating their edits, I went through 
every single change they wanted to make. I do not know if they had done this on 
their software, how I would have gone through every sentence to check if and 
what had been modified.

The publisher usually works with InDesign, but was willing to let me deal with 
production of the print-ready PDF if I could meet her specifications. Again, 
this meant additional work for me. But this was also far more efficient than 
converting everything into Word, and then letting her set it up on InDesign. 
Both these steps would have been far more laborious. For example, I doubt if 
InDesign can make an author index automatically from citations in the way 
biblatex does.

So, the barrier in our case was not to find the most appropriate 
version-control software. The problem was that the other two authors were 
completely unfamiliar with any of these tools. But, even with that, using 
Org-mode was so far superior to shifting to Word or anything of that kind. No 
question.

 Vikas





Re: [O] A book produced using Org

2015-09-19 Thread Manuel Koell
Beautiful! I would love to see the org file! How did emacs perform which
such huge file?

2015-09-20 3:06 GMT+02:00 Vikas Rawal :

>
> > On 20-Sep-2015, at 4:20 am, Pascal Fleury  wrote:
> >
> > Great! Congrats!
> >
> > I was actually wondering: you are 3 authors. How did you collaborate, in
> practice ? There was a thread about using org for collaborative work, but
> it seemed to end in discussing other tools...
> > Was it plain git/emacs and the tools used usually for code management ?
>
>
> Well, unfortunately, the other two authors are not familiar with emacs,
> org-mode, or LaTeX.
>
> The parts they wrote were sent as MS-Word files. I converted them into
> Org-mode.
>
> For the parts I wrote, I sent them PDFs. The first time, I also sent them
> a Word version. I offered them that they could comment in word (with track
> changes) and send me, or better still, work on hard copies and send me the
> scans. The PDFs were so far superior to those word files, that could not
> resist them :). So, their comments came as scans of the commented hard
> copies, and I incorporated them in. Once they were comfortable with this,
> in subsequent rounds, I had to send them only PDFs.
>
> We followed the same process with the copy editors. The copy editors
> worked on hard copies, and I incorporated the comments. This actually had a
> huge advantage since, in the process of incorporating their edits, I went
> through every single change they wanted to make. I do not know if they had
> done this on their software, how I would have gone through every sentence
> to check if and what had been modified.
>
> The publisher usually works with InDesign, but was willing to let me deal
> with production of the print-ready PDF if I could meet her specifications.
> Again, this meant additional work for me. But this was also far more
> efficient than converting everything into Word, and then letting her set it
> up on InDesign. Both these steps would have been far more laborious. For
> example, I doubt if InDesign can make an author index automatically from
> citations in the way biblatex does.
>
> So, the barrier in our case was not to find the most appropriate
> version-control software. The problem was that the other two authors were
> completely unfamiliar with any of these tools. But, even with that, using
> Org-mode was so far superior to shifting to Word or anything of that kind.
> No question.
>
>  Vikas
>
>
>
>


Re: [O] [PATCH] fix SETUPFILE pathname expansion with subdirectories

2015-09-19 Thread Nicolas Goaziou
Hello,

Richard Hansen  writes:

> * lisp/org.el (org--setup-collect-keywords): cd to the directory
> containing the SETUPFILE before recursing so that relative pathnames
> in the SETUPFILE are expanded properly.
>
> * lisp/ox.el (org-export--get-inbuffer-options): cd to the directory
> containing the SETUPFILE before recursing so that relative pathnames
> in the SETUPFILE are expanded properly.
>
> If /path/to/foo.org contains:
>
> #+SETUPFILE: settings/beamer.org
>
> and /path/to/settings/beamer.org contains:
>
> #+SETUPFILE: common.org
>
> then we want to read /path/to/settings/common.org, not
> /path/to/common.org.
>
> TINYCHANGE

Thank you.

Could you also provide add a test for it in "test-org.el"
(test-org/set-regexps-and-options)?


Regards,

-- 
Nicolas Goaziou



Re: [O] Show presence of zero width spaces using overlay

2015-09-19 Thread Kaushal Modi
I got really interested in org-entities (to deal with the case I mentioned
in the first email in this thread like \ast{}shrug\ast{}) and came up with
this:

=

(defun modi/org-entity-get-name (char)
  "Return the entity name for CHAR. For example, return \"ast\" for *."
  (let ((ll (append org-entities-user
org-entities))
e name utf8)
(catch 'break
  (while ll
(setq e (pop ll))
(when (not (stringp e))
  (setq utf8 (nth 6 e))
  (when (string= char utf8)
(setq name (car e))
(throw 'break name)))

(defun modi/org-insert-org-entity-maybe (orig-fun  args)
  "When the universal prefix C-u is used before entering any character,
insert the character's `org-entity' name if available."
  (let ((pressed-key (this-command-keys))
entity-name)
(when (and (listp args) (eq 4 (car args)))
  (setq entity-name (modi/org-entity-get-name pressed-key))
  (when entity-name
(setq entity-name (concat "\\" entity-name "{}"))
(insert entity-name)
(message (concat "Inserted `org-entity' "
 (propertize entity-name
 'face 'font-lock-function-name-face)
 " for the symbol "
 (propertize pressed-key
 'face 'font-lock-function-name-face)
 "."
(when (null entity-name)
  (apply orig-fun args

(advice-add 'org-self-insert-command :around
#'modi/org-insert-org-entity-maybe)

=

After evaluating the above, whenever you do C-u *, C-u /, C-u =, etc, that
symbol's org-entity will be inserted (if available in either
org-entities-user or org-entities).
If an org-entity match is not found, that symbol will be inserted 4 times,
as C-u would usually do.

The message tells the user if the org-entity got inserted so that there is
not confusion.

The advised portion gets executed only if the below 2 conditions match:
- User used C-u prefix (not M-4 or C-u C-u or anything else)
- The entered character has a match in the org entities lists.

Question to the list is: Does this advise mask any useful functionality of
org-self-insert-command?


--
Kaushal Modi

On Sat, Sep 19, 2015 at 12:11 AM, Kaushal Modi 
wrote:

> Here's the MWE once again with proper indication ([ZWS]) of where you need
> to insert the zero width space char.
>
> =
>
> * Escaping =equal= sign in verbatim formatting.
> =a\equal{}b+c=
> ** Here's the same but using zero width spaces instead of /org entities/.
> =a=[ZWS]b+c=
>
> * Here I am trying to have double quotes in verbatim formatting.
> =\quot{}This is inbetween double quotes\quot{}=.
> ** Here's the same but using zero width spaces instead of /org entities/.
> =[ZWS]"This is inbetween double quotes"[ZWS]=.
>
> * And here's to escapes asterisks
> This is *bold*. But this is \ast{}not bold\ast{}.
> This works!
>
> =
>
>
>
> On Sat, Sep 19, 2015 at 12:07 AM Kaushal Modi 
> wrote:
>
>> Thanks for letting me know about org-entities. That is awesome. I now
>> know how to escape various characters in general, but unfortunately this
>> does not work within verbatim formatting (which makes sense).
>>
>> Here's a minimum working example:
>>
>> =
>>
>> * Escaping =equal= sign in verbatim formatting.
>> =a\equal{}b+c=
>> ** Here's the same but using zero width spaces instead of /org entities/.
>> =a=b+c=
>>
>> * Here I am trying to have double quotes in verbatim formatting.
>> =\quot{}This is inbetween double quotes\quot{}=.
>> ** Here's the same but using zero width spaces instead of /org entities/.
>> =​"This is inbetween double quotes"​=.
>>
>> * And here's to escapes asterisks
>> This is *bold*. But this is \ast{}not bold\ast{}.
>> This works!
>>
>> =
>>
>> Here's what it looks like when exported:
>> https://dl.dropboxusercontent.com/u/10985/escape-chars.pdf
>>
>> On Fri, Sep 18, 2015 at 9:48 PM Eric Abrahamsen 
>> wrote:
>>
>>> Kaushal Modi  writes:
>>>
>>> > My most common uses are escaping double quotes (") and equals (=)
>>> > within org verbatim blocks (=VERBATIM=)
>>> >
>>> > Examples:
>>> >
>>> > 1. =var=[ZWS]val=
>>> > 2. =[ZWS]"something"[ZWS]=
>>> >
>>> > Here [ZWS] is the 0x200b zero width space unicode char.
>>> >
>>> > I found [ZWS] useful as a generic escape char for org mode. There are
>>> > few other cases where this has been useful, but I can't recall right
>>> > now.
>>> >
>>> > In any case, what would be the recommended way to escape " and = in
>>> > the above 2 examples?
>>>
>>> Check out the variable `org-entities' for all the replaceable escape
>>> codes. It's got quotes and equal!
>>>
>>> E
>>>
>>>
>>>


Re: [O] Show presence of zero width spaces using overlay

2015-09-19 Thread Eric Abrahamsen
Kaushal Modi  writes:

> I got really interested in org-entities (to deal with the case I
> mentioned in the first email in this thread like \ast{}shrug\ast{})
> and came up with this:

[...]

> Question to the list is: Does this advise mask any useful
> functionality of org-self-insert-command?

This is very cool, in principle! My first reaction would be: people will
probably just want a single command that inserts an entity, either by
name or by the character itself. Tapping into basic keystrokes like this
is very clever, but people only like clever when it's clever exactly the
way they want it, and the more clever a thing is the more opinions
diverge, if that makes sense. Why not just do something like, for
example, `sgml-name-char'?




Re: [O] Using the file as 1st level headline

2015-09-19 Thread Sven Bretfeld

Suvayu Ali writes:

> On Thu, Sep 17, 2015 at 07:55:07PM +0200, Sven Bretfeld wrote:
>> 
>> * TODO Write book on XY
>> ** Introduction
>>Text.
>> * NEXT Something 1
>> * END
>> 
>> ** Chapter 1
>>Text.
>>  TODO Something 2
>>  END
>
> If you are using latex export, you should be able to get the above
> structure to work with a custom latex-class.  Here is an example:
>
> (add-to-list 'org-latex-classes
>'("withtodos" "\\documentclass[11pt]{scrreprt}"
>  (" %s" . " %s")
>  ("\\chapter{%s}" . "\\chapter*{%s}")
>  ("\\section{%s}" . "\\section*{%s}")
>  ("\\subsection{%s}" . "\\subsection*{%s}")
>  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
>
> This will insert the top level headline as a comment.

This is great! I'd have never thought about this. Works perfectly.

Thank you very much

Sven

-- 
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim




Re: [O] Show presence of zero width spaces using overlay

2015-09-19 Thread Nicolas Goaziou
Kaushal Modi  writes:

> My most common uses are escaping double quotes (") and equals (=) within
> org verbatim blocks (=VERBATIM=)
>
> Examples:
>
> 1. =var=[ZWS]val=
> 2. =[ZWS]"something"[ZWS]=
>
> Here [ZWS] is the 0x200b zero width space unicode char.
>
> I found [ZWS] useful as a generic escape char for org mode. There are few
> other cases where this has been useful, but I can't recall right now.
>
> In any case, what would be the recommended way to escape " and = in the
> above 2 examples?

As I said, entities can only escape most Org syntax. Verbatim and code
objects are an exception. Here I think we should introduce an escape
mechanism, much like the one used in macro arguments in order to escape
commas.

For example, in a verbatim object, one only needs to escape "=", using
common "\". Obviously, "\=" constructs can be escaped with "\\=" and so
on. Likewise, in code objects, only "~" needs to be escaped.

In any case, I don't think Org syntax should rely on non-ASCII
characters.

Regards,



Re: [O] Using the file as 1st level headline

2015-09-19 Thread Sven Bretfeld
Eric S Fraga writes:

> On Thursday, 17 Sep 2015 at 19:55, Sven Bretfeld wrote:
>
> [...]
>
> Have you looked at exporting the sub-tree?  If you define the
> appropriate EXPORT_xxx properties in the sub-tree, it should be
> equivalent to having that sub-tree as a file alone.  Check the export
> options at the top of the help window when you type "C-c C-e ?"

Hmm. Not sure how this is actually working. (By the way C-c C-e ? does
not work for me [orgmode 8.3.1 on Emacs 24.5.1, ArchLinux]). What I have
tried now:

,test.org
| 
| * TODO Write Article on Test
| ** Title of the Article
| *** First Chapter
|  First Section of First Chapter
|  Some Text. Some Text. Some Text. Some Text. Some Text. Some Text. Some
|  Text. Some Text. Some Text. Some Text.  Some Text. Some Text. Some
|  Text.  
| *** NEXT Find books on tests :@library:
| *** END
| 
`

This works if I export the subtree with the mark somewhere in the 2nd
line. Otherwise the export would be reduced to the subtree I'm in. The
2nd line must necessarily contain the article title. This makes the
#+TITLE header superfluous.

I could live with such a structure. Even if it means that the first
level of sectioning corresponds to the third org level. What annoys me
more, is the necessity to jump to the 2nd line of the file before doing
an export. Is there a way around this? Maybe by configuring which
subtree to export, no matter where the mark currently is? Is that what
you meant with the EXPORT property definition?

Anyway, thanks for your help. You brought me a good step further. The
rest is a matter of making the solution more convenient.

Sven

-- 
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim




Re: [O] Using the file as 1st level headline

2015-09-19 Thread Suvayu Ali
On Thu, Sep 17, 2015 at 07:55:07PM +0200, Sven Bretfeld wrote:
> 
> * TODO Write book on XY
> ** Introduction
>Text.
> * NEXT Something 1
> * END
> 
> ** Chapter 1
>Text.
>  TODO Something 2
>  END

If you are using latex export, you should be able to get the above
structure to work with a custom latex-class.  Here is an example:

(add-to-list 'org-latex-classes
 '("withtodos" "\\documentclass[11pt]{scrreprt}"
   (" %s" . " %s")
   ("\\chapter{%s}" . "\\chapter*{%s}")
   ("\\section{%s}" . "\\section*{%s}")
   ("\\subsection{%s}" . "\\subsection*{%s}")
   ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))

This will insert the top level headline as a comment.

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] org-collector unable to handle macros

2015-09-19 Thread Nicolas Goaziou
Hello,

Aaron Ecay  writes:

> This looks like the same problem I reported (and provided a patch for) here:
> .  Some orgtbl-*
> functions can’t cope with macro (or macro-resembling) text, because they
> use the exporter, which expects all macros to have valid definitions.
>
> Hopefully this time the bug can actually get fixed, instead of becoming
> bogged down in irrelevant aspects of the context in which it is
> reported.

Fixed. Thank you.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] Fix org-agenda-with-point-at-orig-entry

2015-09-19 Thread Nicolas Goaziou
Hello,

Eric Abrahamsen  writes:

> A comma is missing from this macro's backquote template. Here's a patch
> to add it!

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Show presence of zero width spaces using overlay

2015-09-19 Thread Kaushal Modi
That's correct. That code might be an overkill for people who never needed
org entities.

I thought that I have never used `C-u` before plain single characters, so
why not make use of that in org mode. With that code in place, inserting an
org entity is now C-u away :)

If I happen to need org entities for nonascii chars, I can associate them
to plain letters like `a`, `b`, `c`... in org-entities-user. For example,
`C-u c` can be used to enter copyright symbol org entity.

I haven't yet used `sgml-name-char`, thanks for the tip.

--
Kaushal Modi
On Sep 19, 2015 3:26 AM, "Eric Abrahamsen"  wrote:

> Kaushal Modi  writes:
>
> > I got really interested in org-entities (to deal with the case I
> > mentioned in the first email in this thread like \ast{}shrug\ast{})
> > and came up with this:
>
> [...]
>
> > Question to the list is: Does this advise mask any useful
> > functionality of org-self-insert-command?
>
> This is very cool, in principle! My first reaction would be: people will
> probably just want a single command that inserts an entity, either by
> name or by the character itself. Tapping into basic keystrokes like this
> is very clever, but people only like clever when it's clever exactly the
> way they want it, and the more clever a thing is the more opinions
> diverge, if that makes sense. Why not just do something like, for
> example, `sgml-name-char'?
>
>
>


[O] Escape mechanism in code and verbatim blocks

2015-09-19 Thread Kaushal Modi
@Nicolas

I am with you on not using non-ascii characters to escape stuff.

I like your proposal about escaping in code and verbatim blocks.

--
Kaushal Modi
On Sep 19, 2015 7:35 AM, "Nicolas Goaziou"  wrote:

> Kaushal Modi  writes:
>
> > My most common uses are escaping double quotes (") and equals (=) within
> > org verbatim blocks (=VERBATIM=)
> >
> > Examples:
> >
> > 1. =var=[ZWS]val=
> > 2. =[ZWS]"something"[ZWS]=
> >
> > Here [ZWS] is the 0x200b zero width space unicode char.
> >
> > I found [ZWS] useful as a generic escape char for org mode. There are few
> > other cases where this has been useful, but I can't recall right now.
> >
> > In any case, what would be the recommended way to escape " and = in the
> > above 2 examples?
>
> As I said, entities can only escape most Org syntax. Verbatim and code
> objects are an exception. Here I think we should introduce an escape
> mechanism, much like the one used in macro arguments in order to escape
> commas.
>
> For example, in a verbatim object, one only needs to escape "=", using
> common "\". Obviously, "\=" constructs can be escaped with "\\=" and so
> on. Likewise, in code objects, only "~" needs to be escaped.
>
> In any case, I don't think Org syntax should rely on non-ASCII
> characters.
>
> Regards,
>


[O] A book produced using Org

2015-09-19 Thread Vikas Rawal
I am happy to share with fellow Orgers my recent book —  Ending Malnutrition: 
from commitment to action  — published by the Food and Agriculture Organisation 
of the United Nations, Rome and Tulika Books, New Delhi 
(http://www.fao.org/3/a-i4921e.pdf ),  The 
book was written and produced entirely in Org.

This would not have been possible without the terrific support provided by this 
community. Over the last few months, I have come to this mailing list with 
several queries about how to do something or the other, and people have very 
patiently provided solutions and suggestions. 

I would like to thank everyone for their patience and their support.

Vikas



From acknowledgements of the book:

In addition, for all the statistical work and writing, the authors relied on R 
([[http://www.r-project.org][www.r-project.org]]), org 
([[http://www.orgmode.org][www.orgmode.org]]),
and LaTeX. All three are open source projects, freely made available by very 
vibrant communities of developers. During the course of the work, we often drew 
on support from these communities.