Re: [O] Bug: various short questions about column view, code blocks and export [8.3.4 (release_8.3.4-759-g9508dc @ /home/youngfrog/sources/org-mode/lisp/)]

2016-04-28 Thread Nicolas Richard
Nicolas Goaziou  writes:
> This is a feature. Archived subtrees are ignored when calling column
> view. As you noticed, in this case, removing the tag is the way to go.

ok

> There is no #+NAME: mytable in your example.
> OK, so I guess there wase a TBLNAME line somewhere within the file.

Indeed, sorry, it was lost during the testing.

> Be sure it is located above the table, not above the dynamic block.

thanks, I did not realize this was the way to go :

#+BEGIN: columnview :hlines 1 :id monid :skip-empty-rows t
#+TBLNAME: mytable
...
#+END:

(I thought anything between BEGIN and END would be removed on the next
update -- but the TBLNAME line is kept.)

>> Now when I'm trying to export, I get the same errors as above, even
>> though I have =org-export-babel-evaluate= set to =nil=.
>
> This is fixed.

Indeed, thanks!

-- 
Nicolas



[O] Bug: various short questions about column view, code blocks and export [8.3.4 (release_8.3.4-759-g9508dc @ /home/youngfrog/sources/org-mode/lisp/)]

2016-04-28 Thread Nicolas Richard
Hi all,

The inlined file below contains both the material needed to reproduce
the problems I have and a description of those.

* a tree with some info for column view
  :PROPERTIES:
  :ID:   monid
  :COLUMNS:  %25ITEM %PROP
  :END:
** foo
   :PROPERTIES:
   :PROP: yow
   :END:
** bar
   :PROPERTIES:
   :PROP: bow
   :END:
** baz
   :PROPERTIES:
   :PROP: low
   :END:
* show the column view here
#+BEGIN: columnview :hlines 1 :id monid :skip-empty-rows t
| ITEM | PROP |
|--+--|
| foo  | yow  |
| bar  | bow  |
| baz  | low  |
#+END:
* use the data from the column view in a src block
#+BEGIN_SRC elisp :var chap = mytable :exports results
  'anything
#+END_SRC

* discussion
I open this org file with :
: emacs -q -L ~/sources/org-mode/lisp -l org.el --eval '(setq 
org-export-babel-evaluate nil)' tmp/mytest.org
where tmp/mytest.org is the name of the file.

First, I notice that adding the :ARCHIVE: tag to the first headline
and trying to show column view doesn't work. it seems to do
nothing. Ok so let's remove that tag again.

Now, hitting =C-c C-c= in the code block gives ~Reference not
found~. Which reference is it ? IDK.

Removing the TBLNAME line and hitting =C-c C-c= on the code block
again now gives ~Reference `mytable' not found in this buffer~. I
guess it's a better error ?

Now when I'm trying to export, I get the same errors as above, even
though I have =org-export-babel-evaluate= set to =nil=.

I honestly don't know if I'm doing it wrong or if it's org acting weird.

I have Org-mode version 8.3.4 (release_8.3.4-759-g9508dc @ 
/home/youngfrog/sources/org-mode/lisp/) 
I have GNU Emacs 24.5.50.1 (i686-pc-linux-gnu, GTK+ Version 3.14.10) of 
2015-05-18 on localhost

-- 
Nicolas Richard


Re: [O] Use of deprecated org-log-note-marker variable in outshine

2016-01-31 Thread Nicolas Richard
Nicolas Goaziou  writes:
> Actually, it was a mistake to remove the variable in the first place. As
> a consequence, I re-introduced it in master.
>
> However, it doesn't store the same location as before, i.e., it merely
> points to the entry where the note is going to be added instead of the
> accurate location for the note.

Did you consider renaming it, in the case some code relies on it ?


>   (with-current-buffer (marker-buffer org-log-note-marker)
> (goto-char (org-log-note-marker))
 ^   ^
 I guess those parens are a typo.
> (copy-marker (org-log-beginning)))

-- 
Nicolas



Re: [O] Merge branch 'maint'

2015-09-15 Thread Nicolas Richard
Oleh Krehel  writes:
> Now, please check my facts again. Is it true that Emacs doesn't have
> maint and has instead a bunch of hanging branches for each release that
> aren't meant to have master merged into them on release?

In emacs, the current emacs24 branch will never be used for a release
unless there is a serious concern with emacs-24.5 that needs a
emacs-24.6 release. So it sees no commits, except for the few commits
that "really should go into 24.6 if it is ever released".

Before 24.5 was released, emacs-24 had more commits, and was regularly
merged backinto master.

> If so, what
> exactly is the advantage in applying a patch to a stable branch and then
> merging it into master, instead of applying to patch to master and
> cherry-picking it to the stable branch?

We don't want to create to distinct commits for a given change, because
they will not be related in the git sense (the « DAG ») and it will be
more difficult to e.g. list every branch that has a given change.

> I'm not saying that I'm a Git expert or anything, far from it. But I
> observe the Git history of Emacs and Org regularly, and both models seem
> to be working fine for the users, release-wise. But the master branch of
> Emacs looks a lot better than the master branch of Org, and I don't
> understand the trade-off that Org's model offers to compensate for that
> lack of prettiness.

IIUC Org has a similar model, except that maint is merged far more often
into master (basically after every commit to maint). Probably this is
done so that `master branch users' don't need to wait before seeing the
bugfixes that go to maint.

-- 
Nicolas



Re: [O] Weird Asymptote mode behaviour in org

2015-08-24 Thread Nicolas Richard
Hello,

Jarmo Hurri jarmo.hu...@iki.fi writes:
 * description
   Move cursor into the code below. Press ~C-c '~ to edit the code in
   Asymptote mode. Do not change anything in the code, just press ~C-c
   '~ to return to org. You will notice that a comma has been inserted
   into the code.
 * test case

   #+BEGIN_SRC asymptote
 real s = 50
   * 21.1;
   #+END_SRC

The comma is meant to escape the star (*), see footnote in (info (org)
Literal examples). I'm not sure the comma is required (because your *
isn't at the start of the line), but is shouldn't hurt (i.e. you can C-c
', you can C-c C-c, etc.)

-- 
Nicolas Richard



Re: [O] [OFF TOPIC] almost giving up on emacs email..looking for advice?

2015-08-11 Thread Nicolas Richard
Peter Davis p...@pfdstudio.com writes:
 2) I need a decent editor for replies. I have not found a
 browser-based client that has this.


Firefox has an extension,
https://addons.mozilla.org/fr/firefox/addon/its-all-text/, which allows
you to edit any text in your favourite editor (aka emacs) with
emacsclient.

-- 
Nico



[O] Bug: org-columns adds spaces [8.3beta (release_8.3beta-1286-g20795f @ /home/youngfrog/sources/org-mode/lisp/)]

2015-07-13 Thread Nicolas Richard
Here's my test.org file :
* Test org
:PROPERTIES:
:COLUMNS:  %15foo %fooo %2f %2fo %2foobar %2foobaz %2fooquw %2fooqux %2fooapp %2foopoj %2fooazf %2fooavp %10foopa %1whatever 
:END:

Here's how I test it :
emacs -Q -L ~/sources/org-mode/lisp/ test.org -f whitespace-mode

then hit:
M-x whitespace-mode RET ;; not required
M-x outline-show-all RET ;; not required
C-c C-x C-c ;; enter org-columns
q ;; leave it

The buffer is still marked unmodified but there are five space
characters at the end of the headline. (and this will later confuse org
element cache which thus give errors, but I guess that's to be
expected.)

Emacs  : GNU Emacs 25.0.50.1 (i686-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2015-07-11 on Aurora
Package: Org-mode version 8.3beta (release_8.3beta-1286-g20795f @ 
/home/youngfrog/sources/org-mode/lisp/)


Re: [O] Bug: org-columns adds spaces [8.3beta (release_8.3beta-1286-g20795f @ /home/youngfrog/sources/org-mode/lisp/)]

2015-07-13 Thread Nicolas Richard
Nicolas Richard youngf...@members.fsf.org writes:
 The buffer is still marked unmodified but there are five space
 characters at the end of the headline. (and this will later confuse org
 element cache which thus give errors, but I guess that's to be
 expected.)

Meanwhile I had a look and it's due to this part of
org-columns-display-here :
(org-unmodified (insert  ))

(http://orgmode.org/cgit.cgi/org-mode.git/tree/lisp/org-colview.el?h=maint#n247)

Inserting characters in the buffer for the sake of columnview seems
wrong to me. Even more so if this is done silently.

I tried removing the whole (if then) block. That not only helps with the
spurious spaces, but also makes the column view work better in my
original usecase. OTOH I don't know what it will break.

--- /home/youngfrog/sources/org-mode/lisp/org-colview.el
+++ #buffer org-colview.el
@@ -224,13 +224,7 @@
(overlay-put ov 'org-columns-pom pom)
(overlay-put ov 'org-columns-format f)
(overlay-put ov 'line-prefix )
-   (overlay-put ov 'wrap-prefix ))
-  (if (or (not (char-after beg))
- (equal (char-after beg) ?\n))
- (let ((inhibit-read-only t))
-   (save-excursion
- (goto-char beg)
- (org-unmodified (insert  )) ;; FIXME: add props and remove 
later?
+   (overlay-put ov 'wrap-prefix )))
 ;; Make the rest of the line disappear.
 (org-unmodified
  (setq ov (org-columns-new-overlay beg (point-at-eol)))

-- 
Nicolas Richard



[O] Bug: table example in the manual doesn't export [8.3beta (release_8.3beta-1216-gb856f6 @ /home/youngfrog/sources/org-mode/lisp/)]

2015-07-02 Thread Nicolas Richard
In (info (org) Column groups)

There's an example:
--8---cut here---start-8---
 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
 |---+-+-+-+-+|
 | / || |||   |
 | 1 |   1 |   1 |   1 |   1 |  1 |
 | 2 |   4 |   8 |  16 |  1.4142 | 1.1892 |
 | 3 |   9 |  27 |  81 |  1.7321 | 1.3161 |
 |---+-+-+-+-+|
 #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
--8---cut here---end---8---

But it won't export (e.g. to html) correctly because [4] is interpreted
as a footnote. Here's a (trimmed down) backtrace :

--8---cut here---start-8---
Debugger entered--Lisp error: (error Definition not found for footnote 4)
  signal(error (Definition not found for footnote 4))
  error(Definition not found for footnote %s 4)
  org-export-get-footnote-definition
  (...)
  org-element-map
  (...)
  org-export-collect-footnote-definitions
  org-html-footnote-section
  org-html-inner-template
  org-export-as
  org-export-to-file
  org-html-export-to-html
  org-export-dispatch(nil)
  call-interactively(org-export-dispatch nil nil)
--8---cut here---end---8---

Emacs  : GNU Emacs 25.0.50.2 (i686-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2015-06-11 on Aurora
Package: Org-mode version 8.3beta (release_8.3beta-1216-gb856f6 @ 
/home/youngfrog/sources/org-mode/lisp/)



Re: [O] bisected

2015-04-30 Thread Nicolas Richard
Gregor Zattler telegr...@gmx.net writes:
 First bad commit is:
 bad0409c3b86e09c4559e97d5f394356c6ccbe7f

Nice hash for a bad commit :) 

 This results in a startup error:  
 Debugger entered--Lisp error: (void-variable write-back)

Is it related to your initial problem ?

I think this specific bug was fixed in :
Commit ea575950d957fcecc74ed6f53c29bb6b77e9fe26

modified   lisp/org-src.el
@@ -543,7 +543,7 @@ (define-minor-mode org-src-mode
 (org-set-local
  'header-line-format
  (substitute-command-keys
-  (if write-back
+  (if org-src--allow-write-back
  Edit, then exit with \\[org-edit-src-exit] or abort with \
 \\[org-edit-src-abort]
Exit with \\[org-edit-src-exit] or abort with \

-- 
Nico



Re: [O] bisected

2015-04-30 Thread Nicolas Richard
Gregor Zattler telegr...@gmx.net writes:
 Sorry, no:

From Bastien's comment, I wonder : does the following patch helps ?

--- /dev/fd/63  2015-04-30 13:44:20.900676564 +0200
+++ /tmp/org-src.el 2015-04-30 13:43:50.924673810 +0200
@@ -539,35 +539,36 @@
 - When formatting a source code snippet for export with htmlize.
 There is a mode hook, and keybindings for `org-edit-src-exit' and
 `org-edit-src-save'
-  (when org-edit-src-persistent-message
-(org-set-local
- 'header-line-format
- (substitute-command-keys
-  (if org-src--allow-write-back
- Edit, then exit with \\[org-edit-src-exit] or abort with \
+  (when org-src-mode
+(when org-edit-src-persistent-message
+  (org-set-local
+   'header-line-format
+   (substitute-command-keys
+(if org-src--allow-write-back
+Edit, then exit with \\[org-edit-src-exit] or abort with \
 \\[org-edit-src-abort]
-   Exit with \\[org-edit-src-exit] or abort with \
+  Exit with \\[org-edit-src-exit] or abort with \
 \\[org-edit-src-abort]
-  ;; Possibly activate various auto-save features (for the edit buffer
-  ;; or the source buffer).
-  (when org-edit-src-turn-on-auto-save
-(setq buffer-auto-save-file-name
- (concat (make-temp-name org-src-)
- (format-time-string -%Y-%d-%m)
- .txt)))
-  (unless (or org-src--auto-save-timer (zerop 
org-edit-src-auto-save-idle-delay))
-(setq org-src--auto-save-timer
- (run-with-idle-timer
-  org-edit-src-auto-save-idle-delay t
-  (lambda ()
-(let (edit-flag)
-  (dolist (b (buffer-list))
-(when (org-src-edit-buffer-p)
-  (unless edit-flag (setq edit-flag t))
-  (when (buffer-modified-p) (org-edit-src-save
-  (unless edit-flag
-(cancel-timer org-src--auto-save-timer)
-(setq org-src--auto-save-timer nil
+;; Possibly activate various auto-save features (for the edit buffer
+;; or the source buffer).
+(when org-edit-src-turn-on-auto-save
+  (setq buffer-auto-save-file-name
+(concat (make-temp-name org-src-)
+(format-time-string -%Y-%d-%m)
+.txt)))
+(unless (or org-src--auto-save-timer (zerop 
org-edit-src-auto-save-idle-delay))
+  (setq org-src--auto-save-timer
+(run-with-idle-timer
+ org-edit-src-auto-save-idle-delay t
+ (lambda ()
+   (let (edit-flag)
+ (dolist (b (buffer-list))
+   (when (org-src-edit-buffer-p)
+ (unless edit-flag (setq edit-flag t))
+ (when (buffer-modified-p) (org-edit-src-save
+ (unless edit-flag
+   (cancel-timer org-src--auto-save-timer)
+   (setq org-src--auto-save-timer nil)
 
 (defun org-src-mode-configure-edit-buffer ()
   (when (org-bound-and-true-p org-src--from-org-mode)

-- 
Nicolas.



Re: [O] FR: Fontify links even when in comments

2015-02-24 Thread Nicolas Richard
Nicolas Goaziou m...@nicolasgoaziou.fr writes:
 They cannot contain link, nor anything else. However, the feature you
 describe above was deemed useful enough that `org-open-at-point'
 sloppily opens anything looking like a link (or a timestamp) within
 a comment.

 However, there is, per syntax, no link there, and I don't think it
 should be fontified.

AUCTeX has a variable named `LaTeX-syntactic-comments' :
,
| User option: If non-nil comments will be handled according to LaTeX
|syntax.
`
In AUCTeX, it is mainly about filling and indentation, but in Org it
could mean let the usual (interactive) commands pretend we're not in a
comment. If Org is to adopt such a variable, it could fontify
according to what the interactive commands will do.

Would that be acceptable ? It could be made a minor mode.

-- 
Nicolas Richard.



Re: [O] FR: Fontify links even when in comments

2015-02-24 Thread Nicolas Richard
Le 24/02/2015 15:37, Nicolas Goaziou a écrit :
 Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 
 In AUCTeX, it is mainly about filling and indentation, but in Org it
 could mean let the usual (interactive) commands pretend we're not in a
 comment. If Org is to adopt such a variable, it could fontify
 according to what the interactive commands will do.
 
 This is orthogonal to the current problem. `org-open-at-point' already
 pretends it is not in a comment, but the OP is asking for special
 fontification.

I was suggesting to put these two worms in the same can, which could be
opened by turning org-syntactic-comments-mode on, where all the hideous
special-casing could be done instead of the org core.

 Would that be acceptable ? It could be made a minor mode.
 
 I don't know what are the usual (interactive) commands, so I cannot
 tell.

Tbh, I'm not sure what the others are either. Maybe links are the only
syntactic elements which make sense inside comments, so there isn't
anything else beyond org-open-at-point. If that is the case, I'm just
making noise for no reason -- sorry about that.

Nicolas.



[O] bug#19887: 24.4; Cannot kill buffer; Wrong type argument: overlayp, nil

2015-02-20 Thread Nicolas Richard
Eli Zaretskii e...@gnu.org writes:
 From: Damian Nadales damian.nada...@asml.com
 That's weird. Which buffer are you killing, the Org buffer, or the
 new buffer that is created when pressing C-c ' inside the source
 block? Is the latter the one I cannot kill.

 There was no C-c ' in the recipe you posted.

 What is the full recipe to reproduce the problem, please?

PMJI, but at http://permalink.gmane.org/gmane.emacs.orgmode/95159,
Nicolas Goaziou said This should be fixed.

Perhaps this bug report can simply be closed then ?

IIUC, he fixed it in:
--8---cut here---start-8---
Commit c41bbc577e81e9fa5bab2509a8141189e45fe6c7
References: origin/maint
Author: Nicolas Goaziou m...@nicolasgoaziou.fr
AuthorDate: Wed Feb 18 01:59:51 2015 +0100
Commit: Nicolas Goaziou m...@nicolasgoaziou.fr
CommitDate: Wed Feb 18 01:59:51 2015 +0100

Fix Wrong type argument: overlayp

* lisp/org-src.el (org-src-mode-configure-edit-buffer): Fix Wrong
  type argument: overlayp.

Changing major mode in a source edit buffer resets local variables
used to link it to source buffer.  As a consequence, overlay in source
buffer can no longer be found nor deleted.
--8---cut here---end---8---

-- 
Nicolas Richard





Re: [O] org-time-stamp adds repeater where there is none.

2015-02-16 Thread Nicolas Richard
Nicolas Goaziou m...@nicolasgoaziou.fr writes:
 2015-02-13 ven. (10h-13h)

 Hiting C-c . RET with point on the timestamp gives
 2015-02-13 ven. -13h (10h-13h)

 which is not expected.

 It should now be fixed.

Thanks, works great so far (unlike my own patch, which would fail in
some situations).

-- 
Nicolas



[O] org-time-stamp adds repeater where there is none.

2015-02-13 Thread Nicolas Richard
Consider the following line:

2015-02-13 ven. (10h-13h)

Hiting C-c . RET with point on the timestamp gives
2015-02-13 ven. -13h (10h-13h)

which is not expected.

Please consider the patch below


From 688851438f363eaa86dcfe2acfb779d6c22adc16 Mon Sep 17 00:00:00 2001
From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Fri, 13 Feb 2015 16:57:59 +0100
Subject: [PATCH] * lisp/org.el (org-time-stamp): Restrict to timestamp when
 determining repeater.

---
 lisp/org.el | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 7c2419d..6a0e4c6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16149,12 +16149,13 @@ (defun org-time-stamp (arg optional inactive)
   (apply 'encode-time (org-parse-time-string (match-string 1)))
 (current-time)))
 (default-input (and ts (org-get-compact-tod ts)))
-(repeater (save-excursion
-(save-match-data
-  (beginning-of-line)
-  (when (re-search-forward
+(repeater (save-match-data
+(with-temp-buffer
+  (insert ts)
+  (goto-char (point-min))
+  (when (re-search-forward
  \\([.+-]+[0-9]+[hdwmy] ?\\)+ ;;\\(?:[/ 
][-+]?[0-9]+[hdwmy]\\)?\\) ?
- (save-excursion (progn (end-of-line) (point))) t)
+ nil t)
 (match-string 0)
 org-time-was-given org-end-time-was-given time)
 (cond
-- 
2.1.4



Re: [O] bug: isearch puts ellipses at top of window

2015-01-17 Thread Nicolas Richard
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Samuel Wales samolog...@gmail.com writes:

 run this (after substituting in where you keep org maint) and search
 for lightly org:

 thanks.

 samuel

 === call

 emacs -Q --geometry -0+0 --geometry 80x30 --eval '(setq load-path
 (append (list(substitute-in-file-name $delorgsrc/lisp)
 (substitute-in-file-name $delorgsrc/contrib/lisp)) load-path))'
 bug-isearch.org

 ===

 here is the org file to use:

 === bug-isearch.org

 FWIW, I cannot reproduce it.

I retried and reproduced it with
emacs -Q -g 80x24+0+0 -L ~/sourcetrees/org-mode/lisp ~/tmp/bug-isearch.org


-- 
Nicolas Richard



Re: [O] bug: isearch puts ellipses at top of window

2015-01-17 Thread Nicolas Richard
Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 Nicolas Goaziou m...@nicolasgoaziou.fr writes:
 FWIW, I cannot reproduce it.

 I retried and reproduced it with
 emacs -Q -g 80x24+0+0 -L ~/sourcetrees/org-mode/lisp
 ~/tmp/bug-isearch.org

Oops, my message went gone faster than I expected, sorry for its
brevity!

-- 
Nicolas Richard



Re: [O] Getting beginning postiion of a description list

2015-01-15 Thread Nicolas Richard
Calvin Young calvinwyo...@gmail.com writes:
 How do I need to massage this to give me the beginning of the whole
 list item? Is there a recommended solution that'd work for both
 description lists *and* plain lists?

This seems to work for me:

(defun yf/org-beginning-of-item ()
  (let ((element (org-element-at-point)))
;; 'plain-list is returned when at the beginning of the first item in the 
list.
(when (eq 'plain-list (org-element-type element))
  (save-excursion
(forward-char)
(setq element (org-element-at-point
;; look ancestors to find an 'item element.
(while (and element
(not
 (eq 'item
 (org-element-type element
  (setq element (org-element-property :parent element)))
(if (not element)
(error Not in a list item)
  (goto-char
   (+ (length (org-element-property :bullet element))
  (org-element-property :begin element))

Probably one could use the list API directly (from org-list.el) too.

-- 
Nicolas Richard



Re: [O] Args out of range: #buffer test.org, 0, 1

2015-01-13 Thread Nicolas Richard


Hello,

Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:
 I tried to edebug the function `org-babel-demarcate-block' and the error
 arises quite at the beginning: on the `match-string 0', on the second
 line of the `let*'.

The error means we tried to access portions from 0 to 1 in a buffer.
That doesn't exist. The reason is that the match data was built when
matching on a string (where 0 is a valid position), and we're trying to
use it on a buffer. It simply means that we're trying to access the
match data without actually checking that we matched something.

Reproduce with:
(progn (string-match \\(\\(\\(\\(.\\)\\)\\)\\) foo) ; this sets the match 
data
   (with-temp-buffer
 (org-babel-demarcate-block))) ; tries to access the match data,
   ; but never matched anything successfully

 - I can't reproduce it in a minimal Emacs, and there... edebug ends in
   an error (I wanted to compare the execution steps), as you can see on
   the right screen of http://screencast.com/t/A5ldV2yHNna.
   
   Why is edebug crashing?

Did you perhaps kill the buffer where org-babel-demarcate-block
was instrumented for edebug ?

 - It seems normal that `org-babel-where-is-src-block-head' returns nil
   when we use `C-c C-v C-d' to create the first code block in a buffer
   which did not contain any... and it works in my minimal Emacs... (iff
   edebug is turned off)

 Any idea of the problem, then?

I think the `progn' in org-babel-demarcate-block should be `and'.

(I also think that the fact that the match data is set according to
org-babel-src-block-regexp when calling
org-babel-where-is-src-block-head should be documented in that
function. Relying on undocumented side effects is nasty.)

HTH,

-- 
Nico




Re: [O] Args out of range: #buffer test.org, 0, 1

2015-01-13 Thread Nicolas Richard


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:
 This still leaves me with one question: how do we reproduce the problem?
 What's the trigger for it?

Mostly luck. i.e. you need to have called a function that callled
string-match on a string, with a regexp containing (at least) 4 grouping
constructs, and the 4th matched at the beginning of that string
(beginning position 0) but only one character (end position 1) [1]. And
then later call org-babel-demarcate-block. Between the two, many things
may have happened as long as the match data was preserved.

[1] I gave an example of such a call to string-match -- my example
wasn't super useful I admit. In your case, it could be anything : not
necessarily an org function. Many functions use string-match internally.

 PS- @NicolasG, thanks for fixing it...

And also thanks for mentionning org-babel-src-block-regexp... and
completely rewriting org-babel-where-is-src-block-head. Very impressive!

-- 
Nicolas.




Re: [O] spreadsheet: empty field should be an empty field.

2014-09-16 Thread Nicolas Richard
Michael Brand michael.ch.br...@gmail.com writes:

 On Tue, Sep 16, 2014 at 11:42 AM, Thorsten Jolitz tjol...@gmail.com wrote:
 I think something like NaN was introduced to Org-tbls, but I don't
 remember the exact syntax, maybe try with 'nan':

 http://lists.gnu.org/archive/html/emacs-orgmode/2012-12/msg00983.html

 Yes, and I already documented the OP use case in the second example here:
 http://orgmode.org/manual/Formula-syntax-for-Calc.html

This is something I tend to forget (and usually work around with some
lisp). Thanks for the reminder.

-- 
Nicolas Richard



Re: [O] How to represent this in Org-mode

2014-08-27 Thread Nicolas Richard
Hi Marcin,

Marcin Borkowski mb...@wmi.amu.edu.pl writes:
  How to represent such a partially ordered set in
 Org-mode?  One idea that comes to my mind is writing a normal outline
 (tree) with all the modules (possibly nested), and including links to
 all prerequisites in every such module.  Any other ideas?

I'm quite curious to know how you solved the problem, since I might try
to do something similar (but probably not with Org mode). Would you like
to share your solution ?

Thanks,

-- 
Nico.




[O] invalid property drawer and C-c C-x p

2014-08-25 Thread Nicolas Richard
Hi,

Sometimes I apparently manage to corrupt my org files by having an
unfinished drawers in them. Of course this is wrong and I should
investigate, but if it happens, hitting C-c C-x p leads to a useless
error (Wrong type argument: integer-or-marker-p, nil). I suggest to
following patch for a better error:

diff --git a/lisp/org.el b/lisp/org.el
index adfbeaa..4489287 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15612,6 +15612,8 @@ formats in the current buffer.
(goto-char (point-min))
(while (re-search-forward org-property-start-re nil t)
  (setq range (org-get-property-block))
+ (when (not range)
+   (error Invalid property block in buffer %s at position %d 
(current-buffer) (point)))
  (goto-char (car range))
  (while (re-search-forward org-property-re
  (cdr range) t)

To test it :
(with-temp-buffer
   (org-mode)
   (insert * foo\n:PROPERTIES:\n:BAR: \n\n bal)
   (org-set-property nil nil))


-- 
Nicolas Richard



Re: [O] [Bulk] Re: invalid property drawer and C-c C-x p

2014-08-25 Thread Nicolas Richard
Le 25/08/2014 15:38, Nicolas Goaziou a écrit :
 AFAICT, a similar mechanism is already implemented in master.

Oh great, sorry for the noise then !

-- 
Nicolas.




Re: [O] [RFC] [PATCH] ox-latex: support :float no with caption for minted listings

2014-08-24 Thread Nicolas Richard
Aaron Ecay aarone...@gmail.com writes:

 With your patch, when encountering the combination above, the export
 back-end will introduce a captionof command, which requires loading
 caption package with a specific option (i.e., compatibility=false).

 Why is the compatibility=false option needed?  I can’t figure this
 out.

I didn't read the rest of this thread, but if all we need is \captionof,
please use the capt-of package instead. It'll avoid compatibility issues
with other classes/packages a user might load.

-- 
Nico.



Re: [O] org-element-at-point fails in programming-modes

2014-08-22 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 Maybe they switched to the new parser between versions, that parses a
 src-block with :post-blank's, but does not take them into account when
 interpreting? 

I tried an experiment : (defun org-mode (rest _) t) and refresh. The
newlines didn't come back (but fontification obviously disappeared). So
I guess it isn't org-mode's fault.

I would like to blame (mm-uu-dissect) but I didn't look into it. I'll
take the opportunity to test if it'll also eat multiple blank lines (I
think it will) :

#+BEGIN_QUOTE
hallo world
#+END_QUOTE

#+BEGIN_COMMENT
hallo world
#+END_COMMENT


#+BEGIN_EXAMPLE
hallo world
#+END_EXAMPLE



#+BEGIN_SRC emacs-lisp
hallo world
#+END_SRC

(There should be 1, then 2, then 3 blanks lines between the successives
blocks above.)

-- 
Nico.



Re: [O] org-element-at-point fails in programming-modes

2014-08-22 Thread Nicolas Richard
Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 I would like to blame (mm-uu-dissect) but I didn't look into it.

I now blame (mm-uu-dissect). The following patch fixes it, but that part
of the code must be there for a reason... and I don't know what it is.

Modified   lisp/gnus/mm-uu.el
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index 423324a..2200caa 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -668,10 +668,7 @@ value of `mm-uu-text-plain-type'.
 (setq end-point (point)
   (or (not (setq func (mm-uu-function-2 entry)))
   (funcall func)))
- (if (and ( start-point text-start)
-  (progn
-(goto-char text-start)
-(re-search-forward . start-point t)))
+ (if ( start-point text-start)
  (push
   (mm-make-handle (mm-uu-copy-to-buffer text-start start-point)
   mm-uu-text-plain-type)


-- 
Nico.



Re: [O] org-element-at-point fails in programming-modes

2014-08-21 Thread Nicolas Richard
Nick Dokos ndo...@gmail.com writes:
 One machine is running Gnus v. 5.13: that one smooshes the code
 blocks together.

 The other is running Ma Gnus v. 0.12: that one leaves empty
 lines between blocks.

Do they both fontify blocks ?

-- 
Nico.



Re: [O] org-element-at-point fails in programming-modes

2014-08-20 Thread Nicolas Richard
 Although Org functions are of course made only for working in org-mode
 and its a bit hard to see at first sight how this could be useful, I
 wonder if the regexps could be made a bit more general to make
 `org-element-at-point' work in programming modes too (most likely this
 behaviour is caused by references to character-classes that differ in
 text-modes and programming-modes)?

The reason is that a newline has the endcomment syntax in programming
modes, but has whitespace syntax in text modes. So the regexp
\\+BEGIN_\\(\\S-+\\) (which can be found in org-element.el) matches
e.g. +BEGIN_QUOTE\nhallo instead of just +BEGIN_QUOTE.
(\\S- means anything that doesn't have whitespace syntax)

You could wrap your code in a (with-syntax-table org-mode-syntax-table
...) and cross fingers, or simply do the (org-element-at-point)
computations in a temporary (org-mode) buffer.

HTH,

-- 
Nico.



Re: [O] org-element-at-point fails in programming-modes

2014-08-20 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 Am I the only one seeing this? Bug in gnus/message mode?

I also see the problem. I suspect that it happens when Gnus fontifies
the blocks. Doing C-u g shows that the source of the message is
correct (i.e. has the newlines).

-- 
Nico.



Re: [O] How to represent this in Org-mode

2014-08-14 Thread Nicolas Richard
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Hello,

 now that I learned how to use a hammer, everything looks like a nail.
 So I want to use Org-mode for this; my question is, did anyone do
 anything similar and has some suggestions how to structure this
 material?

I did not do it, but still have one suggestion.

Each module could come with a name (e.g. CUSTOM_ID) and you could add a
:PREREQ: property listing all the other modules that are
prerequisite of that one.

It might then take some lisp to convert the data into an actual
dependency graph. graphviz might also come in handy for this task : it
allows to draw directed graphs easily. see below, I ended up writing
some of that lisp.

Imagine an org file like this:
#+BEGIN_SRC org
  ,* Module A
  :PROPERTIES:
  :CUSTOM_ID: A
  :END:
  ,* Module B
  :PROPERTIES:
  :CUSTOM_ID: B
  :PREREQ:   A
  :END:
  ,* Module C
  :PROPERTIES:
  :CUSTOM_ID: C
  :PREREQ:   A
  :END:
  ,* Module D
  :PROPERTIES:
  :CUSTOM_ID: D
  :PREREQ:   A B
  :END:
#+END_SRC

It could be translated to an graphviz code like this one very easily :

#+BEGIN_SRC dot :file dot-example3.png
   digraph test123 {
   {A} - B;
   {A} - C;
   {A B} - D;
   }
#+END_SRC
which then compiles into a dependency graph. (note that {A}- B could
also be written as A - B, but an automated translation mechanism
doesn't need to do that)

Here's some more graphviz code (taken from the manpage IIRC, the
comments in french are mine) to see what it can do if you want more:

#+begin_src dot :file dot-example.png
  digraph test123 {
  // on peut faire un digraphe sans tête de flèches!
  edge [arrowhead=none];
  // créer des flèches
  a - b - c;
  // créer des flèches d'un noeud vers plusieurs
  a - {x y} [weight=10];
  // donner la forme d'un noeud
  b [shape=box];
  // donner un nom, une couleur, etc. à un noeud
  c [label=hello\nworld,color=blue,fontsize=24,
   fontname=Palatino-Italic,fontcolor=red,style=filled];
  // créer une flèche avec un label et un poids.
  // si on diminue le poids (4, 3, 2, 1, 0), la flèche se courbe.
  a - z [label=hi, weight=60];
  // label multiligne.
  x - z [label=multi-line\nlabel];
  // 
  edge [style=dashed,color=red,arrowhead=normal];
  {rank=same; b-x};
  }
#+end_src

Because I was curious, I wrote a few lines of elisp to do the
conversion:

;; call this one via M-x ...
(defun yf/org-dependencies ()
  (interactive)
  (with-output-to-temp-buffer (get-buffer-create *OrgFormatDeps*)
(princ digraph OrgDeps {\n)
(org-map-entries 'yf/org-format-dependency)
(princ })
(terpri)
(pop-to-buffer (current-buffer

;; this is a helper function
(defun yf/org-format-dependency ()
  (let ((id (org-entry-get (point) CUSTOM_ID))
(prereqs (org-entry-get-multivalued-property (point) PREREQ)))
(when (and id prereqs)
  (princ
   (concat  {
   (mapconcat 'identity prereqs  )
   } - 
   id
   ;))
  (terpri


-- 
Nico.



Re: [O] shorcut for #+BEGIN_xxx ... #+END_xxx

2014-08-14 Thread Nicolas Richard
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes:
 I know that there is s TAB for source , l TAB for latex and so on,
 but it would maybe be useful to choice the environment, like with C-e
 in LateX + auctex, or like with C { with CD latex. 

See:
https://github.com/fniessen/org-auctex-key-bindings/blob/master/org-auctex-keys.el
The function org-auckeys-environment I think it does what you want.

you also have C-c C-v C-d for src blocks and selecting the language
with completion.

-- 
Nico.



Re: [O] bug: isearch puts ellipses at top of window

2014-08-05 Thread Nicolas Richard
Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 Samuel Wales samolog...@gmail.com writes:

 in maint, isearch very often puts ... at the top of the window.  is
 this related to recent ellipsis bugs?

 If you have a reproducible recipe, it would be very nice !

I think I have something -- not with isearch but certainly related.
Unfortunately I'm not sure if this should be considered an emacs bug or
if it should be fixed in Outline or in Org, so I'll simply ask about it.
I did it on bug#18197.

-- 
Nico.



Re: [O] Bug: [PATCH] Make org-narrow-to-subtree usable out of Org mode [8.2.7b (release_8.2.7b-6-g07d470 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-07-31 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 Thanks for the URL. The description looks great but why not patch
 outline.el instead of making it an external library ? Is there an
 incompatibility ?

 Well, outshine merges quite old extension libraries for outline like
 outline-magic (Carsten Dominik) and out-xtra (Per Abrahamsen) and adds
 lots of new stuff. Why did the old guys back then wrote extensions
 instead of patching outline? No idea ...

Sorry, I only meant to speak about outline-magic.

Thanks for the detailed descriptions though.

-- 
Nico.



Re: [O] define a new export backend

2014-07-31 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 Shiyuan gshy2...@gmail.com writes:
 (org-export-define-derived-backend 'my-html-enlish 'html
 :traslate-alist '((bold . my-org-html-english-bold))


 :translate-alist ?

Perhaps org-export-define-derived-backend could do a sanity check that
all keywords are known. use-package does that, and it has saved me
multiple times ! Nicolas, what am I overlooking ?

Modified   lisp/ox.el
diff --git a/lisp/ox.el b/lisp/ox.el
index 03bd8bb..e931723 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1187,9 +1187,9 @@ The back-end could then be called with, for example:
 
   \(org-export-to-buffer 'my-latex \*Test my-latex*\)
   (declare (indent 2))
-  (let (blocks filters menu-entry options transcoders contents)
+  (let (blocks filters menu-entry options transcoders contents keyword)
 (while (keywordp (car body))
-  (case (pop body)
+  (case (setq keyword (pop body))
(:export-block (let ((names (pop body)))
 (setq blocks (if (consp names) (mapcar 'upcase names)
(list (upcase names))
@@ -1197,7 +1197,7 @@ The back-end could then be called with, for example:
(:menu-entry (setq menu-entry (pop body)))
 (:options-alist (setq options (pop body)))
 (:translate-alist (setq transcoders (pop body)))
-(t (pop body
+(t (error Unknown keyword in `org-export-define-derived-backend': %s 
keyword
 (org-export-register-backend
  (org-export-create-backend :name child
:parent parent

-- 
Nico.



Re: [O] define a new export backend

2014-07-31 Thread Nicolas Richard
Nicolas Goaziou m...@nicolasgoaziou.fr writes:
 Good idea, as long as `org-export-define-backend' does the same.

Oops, I forgot to remove the verbosity (initially I had wrote it as a
(warn ...)). Here's an updated patch.

From 117623cec251cd036b601e2481643296cc4e2c37 Mon Sep 17 00:00:00 2001
From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Thu, 31 Jul 2014 10:48:54 +0200
Subject: [PATCH] Signal an error if keyword is unknown while defining backends

* lisp/ox.el (org-export-define-backend):
(org-export-define-derived-backend): Signal an error if keyword is unknown
---
 lisp/ox.el | 36 +++-
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 03bd8bb..e2965c4 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1118,14 +1118,15 @@ keywords are understood:
   (declare (indent 1))
   (let (blocks filters menu-entry options contents)
 (while (keywordp (car body))
-  (case (pop body)
-(:export-block (let ((names (pop body)))
-			 (setq blocks (if (consp names) (mapcar 'upcase names)
-	(list (upcase names))
-	(:filters-alist (setq filters (pop body)))
-	(:menu-entry (setq menu-entry (pop body)))
-(:options-alist (setq options (pop body)))
-(t (pop body
+  (let ((keyword (pop body)))
+	(case keyword
+	  (:export-block (let ((names (pop body)))
+			   (setq blocks (if (consp names) (mapcar 'upcase names)
+	  (list (upcase names))
+	  (:filters-alist (setq filters (pop body)))
+	  (:menu-entry (setq menu-entry (pop body)))
+	  (:options-alist (setq options (pop body)))
+	  (t (error Unknown keyword: %s keyword)
 (org-export-register-backend
  (org-export-create-backend :name backend
 :transcoders transcoders
@@ -1189,15 +1190,16 @@ The back-end could then be called with, for example:
   (declare (indent 2))
   (let (blocks filters menu-entry options transcoders contents)
 (while (keywordp (car body))
-  (case (pop body)
-	(:export-block (let ((names (pop body)))
-			 (setq blocks (if (consp names) (mapcar 'upcase names)
-	(list (upcase names))
-(:filters-alist (setq filters (pop body)))
-	(:menu-entry (setq menu-entry (pop body)))
-(:options-alist (setq options (pop body)))
-(:translate-alist (setq transcoders (pop body)))
-(t (pop body
+  (let ((keyword (pop body)))
+	(case keyword
+	  (:export-block (let ((names (pop body)))
+			   (setq blocks (if (consp names) (mapcar 'upcase names)
+	  (list (upcase names))
+	  (:filters-alist (setq filters (pop body)))
+	  (:menu-entry (setq menu-entry (pop body)))
+	  (:options-alist (setq options (pop body)))
+	  (:translate-alist (setq transcoders (pop body)))
+	  (t (error Unknown keyword: %s keyword)
 (org-export-register-backend
  (org-export-create-backend :name child
 :parent parent
-- 
1.8.5.5


-- 
Nico.


Re: [O] Bug: [PATCH] Make org-narrow-to-subtree usable out of Org mode [8.2.7b (release_8.2.7b-6-g07d470 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-07-30 Thread Nicolas Richard
Hello Bastien,

Bastien b...@gnu.org writes:
 I think it's fine to bind `org-narrow-to-subtree' in narrow-map.
 It's basically to enjoy the `C-x n prefix', which is natural here.

I agree, but it is not compatible with keeping it only for org-mode
buffers while using something else for some other modes, which is what
you suggest next :

 I applied your patch, but a good continuation would be to have
 C-h n s bound to `outline-narrow-to-subtree' in outline-mode and
 to `org-narrow-to-subtree' in org-mode, instead of just relying
 on one single function.

 This requires simplifying `org-narrow-to-subtree' and creating
 `outline-narrow-to-subtree' in emacs.

 What do you think?

I think backporting narrow-to-subtree to outline is a very good move.
(Other things would be cool in outline, e.g. why does it not have
outline-cycle ? But that's a longer story, I guess.)

Another possibility : wouldn't it make sense to hijack narrow-to-defun
for this ? In fact, it used to be that way, but then it was changed in
76fa979225a2a31f7be6d366c48750d4f7abe458 (and then reverted, and then
the revert was reverted, and I have no idea why).

Looking more closely, the current behaviour is partly buggy, e.g. with a
file like :

* one
** two
** three
* four

When point is on the second line and C-M-e is used, we end up on the
first line ! I see two reasons for this or similar failures :
- One is a bug in org-forward-heading-same-level (I provide a patch
below).
- The other is because org-backward-element doesn't fully satisfy the
beginning-of-defun usual protocol since it sometimes signals an error.

Here's a test for catching the bug in org-forward-heading-same-level:
(org-test-with-temp-text \
* one
* two

   (goto-line 2)
   (org-forward-heading-same-level -1)
   (should (bobp)))

And here's the patch for org-forward-heading-same-level.

Modified   lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index 0e15710..741c9b5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -23328,9 +2,10 @@ non-nil it will also look at invisible ones.
're-search-forward))
   (count (if arg (abs arg) 1))
   (result (point)))
-  (while (and (prog1 ( count 0)
-   (forward-char (if (and arg ( arg 0)) -1 1)))
-  (funcall f org-outline-regexp-bol nil 'move))
+  (while (and ( count 0)
+ (progn
+   (forward-char (if (and arg ( arg 0)) -1 1))
+   (funcall f org-outline-regexp-bol nil 'move)))
 (let ((l (- (match-end 0) (match-beginning 0) 1)))
   (cond (( l level) (setq count 0))
 ((and (= l level)

Want a git-format-patch one ?

Also, here's a test where I don't know what should happen (currently
signals a user-error) :

(org-test-with-temp-text \
one
* two

   (goto-line 2)
   (org-backward-element)
   (should t))


-- 
Nico.



Re: [O] Bug: [PATCH] Make org-narrow-to-subtree usable out of Org mode [8.2.7b (release_8.2.7b-6-g07d470 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-07-30 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:

 Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 I think backporting narrow-to-subtree to outline is a very good move.
 (Other things would be cool in outline, e.g. why does it not have
 outline-cycle ? But that's a longer story, I guess.)

 It does via outline-magic.el (now maintained by me:
 https://github.com/tj64/outline-magic), and the short story is (my

 It is fully integrated (and partly improved and expanded) in outshine.el

Thanks for the URL. The description looks great but why not patch
outline.el instead of making it an external library ? Is there an
incompatibility ?

-- 
Nico.



Re: [O] Where is the git master branch?

2014-07-30 Thread Nicolas Richard
Sharon Kimble boudic...@skimble.plus.com writes:
 If git clone git://orgmode.org/org-mode.git gets the development
 branch of org-mode, what is the git command to get the master branch
 please? I've been looking on http://orgmode.org/ but can't see any
 reference for it.

The 'master' branch is the development/unstable branch. The stable
branch is called 'maint'.

-- 
Nico.



Re: [O] org-envolve?

2014-07-29 Thread Nicolas Richard
David Arroyo Menendez davi...@gnu.org writes:
 Yes, I have some ítems

 mapcar
 defun
 apply
 cons

 Then I mark the region of this ítems, apply the function and obtain:

 + [ ] mapcar
 + [ ] defun
 + [ ] apply
 + [ ] cons

FWIW, I use rectangular insertion for this :
1. select region (mark on the first 'm', point on the last 'c', or conversely)
2. add string - [ ]  using C-x r t (string-rectangle).

-- 
Nico.



Re: [O] What is the best in-Emacs presentation mode for org-files today?

2014-07-29 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:

 John Kitchin jkitc...@andrew.cmu.edu writes:

 Hi John, 

 I agree with org-mode. Check out
 https://www.youtube.com/watch?v=JZ8RK-R9O_g, which is an illustration of
 some code I adapted from Sacha Chua. At the top of
 https://github.com/jkitchin/jmax/blob/master/org-show.org you can find
 some links to other presentation tools in Emacs.

 this looks very nice, but how do I get it?

Just from the name of the files (org-show.org and org-show.el) and the
fact that this is Org mode, I would say you should tangle the org file
to get the .el file !

-- 
Nico.



Re: [O] bug: isearch puts ellipses at top of window

2014-07-29 Thread Nicolas Richard
Samuel Wales samolog...@gmail.com writes:

 in maint, isearch very often puts ... at the top of the window.  is
 this related to recent ellipsis bugs?

If you have a reproducible recipe, it would be very nice !

TIA,

-- 
Nico.



Re: [O] Bug: [PATCH] Make org-narrow-to-subtree usable out of Org mode [8.2.7b (release_8.2.7b-6-g07d470 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-07-24 Thread Nicolas Richard
Nicolas Goaziou m...@nicolasgoaziou.fr writes:
 `org-narrow-to-subtree' is an Org function. I don't think it should
 bother about non Org mode buffers.

It's an Org function that grafts itself to narrow-map, which is globally
available.

I think it should try to have at least a sensible error message. The
current Before first headline isn't quite clear (my patch doesn't
address this, btw).

 It looked pretty easy to fix, so here is my suggestion, below. It should
 be rather harmless since it only affects non-Org buffers (and might have
 the nice side effect of allowing other commands to run in those buffers
 -- but I haven't checked.)

 There was a discussion recently about making it easier to use some Org
 features outside of Org.

I guess you're talking about
http://thread.gmane.org/gmane.emacs.orgmode/84782

 IIRC, the conclusion was that should not happen
 at the core level, but as an external layer (e.g., a minor mode).

If core Org functions only care about org-mode buffers, I guess it is
hard to make a minor mode that reuses some of Org to do its job. Unless
that mode is itself in the core of course. e.g. orgstruct-mode does that
and it needs some core support.

Anyway, my goal isn't to discuss a whole org minor mode.

-- 
Nico.



Re: [O] Bug: [PATCH] Make org-narrow-to-subtree usable out of Org mode [8.2.7b (release_8.2.7b-6-g07d470 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-07-24 Thread Nicolas Richard
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 I think it should try to have at least a sensible error message. The
 current Before first headline isn't quite clear (my patch doesn't
 address this, btw).

 Not in an Org mode buffer could be better indeed.

 Anyway, this kind of change (including compatibility with outline.el)
 belongs to the high-level function `org-narrow-to-subtree', not the very
 specific `org-get-limited-outline-regexp'.

Agreed.

But now that I think about it, org mode simply should avoid narrow-map
completely : users (me included) won't randomly try to run
org-narrow-to-subtree outside of org buffers (and those who do deserve a
bad error message) but they might want to give C-x n s a try if it is
available.

While writing a patch for changing that, I see that the code is:
(if (boundp 'narrow-map)
(org-defkey narrow-map s 'org-narrow-to-subtree)
  (org-defkey org-mode-map \C-xns 'org-narrow-to-subtree))
(if (boundp 'narrow-map)
(org-defkey narrow-map b 'org-narrow-to-block)
  (org-defkey org-mode-map \C-xnb 'org-narrow-to-block))
(if (boundp 'narrow-map)
(org-defkey narrow-map e 'org-narrow-to-element)
  (org-defkey org-mode-map \C-xne 'org-narrow-to-element))

IOW, org.el purposely binds in narrow-map ! So now I don't get it :
either it's in narrow-map and should be usable widely, or it's in
org-mode-map only for org-mode files.

-- 
Nico.



[O] Bug: [PATCH] Make org-narrow-to-subtree usable out of Org mode [8.2.7b (release_8.2.7b-6-g07d470 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-07-22 Thread Nicolas Richard
Hello all,

org-narrow-to-subtree is very nice, and I now have C-x n s hard-wired
into my fingers, but it doesn't work when outline-regexp is too
different from org-outline-regexp in Outline-but-non-Org mode buffers.

It looked pretty easy to fix, so here is my suggestion, below. It should
be rather harmless since it only affects non-Org buffers (and might have
the nice side effect of allowing other commands to run in those buffers
-- but I haven't checked.)

From 70ccd90f98d07762d7ae228d67c387d674a69cee Mon Sep 17 00:00:00 2001
From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Tue, 22 Jul 2014 18:29:00 +0200
Subject: [PATCH] Make org-get-limited-outline-regexp usable outside of org.

This allows org-narrow-to-subtree to function in Outline mode.

* lisp/org-macs.el (org-get-limited-outline-regexp): Use
  outline-regexp instead of org-outline-regexp when not in Org mode.
---
 lisp/org-macs.el | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 96265ec..78174df 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -352,11 +352,16 @@ point nowhere.
 (defun org-get-limited-outline-regexp ()
   Return outline-regexp with limited number of levels.
 The number of levels is controlled by `org-inlinetask-min-level'
-  (if (or (not (derived-mode-p 'org-mode)) (not (featurep 'org-inlinetask)))
-  org-outline-regexp
-(let* ((limit-level (1- org-inlinetask-min-level))
-  (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
-  (format \\*\\{1,%d\\}  nstars
+  (cond ((not (derived-mode-p 'org-mode))
+outline-regexp)
+   ((not (featurep 'org-inlinetask))
+org-outline-regexp)
+   (t
+(let* ((limit-level (1- org-inlinetask-min-level))
+   (nstars (if org-odd-levels-only
+   (1- (* limit-level 2))
+ limit-level)))
+  (format \\*\\{1,%d\\}  nstars)
 
 (defun org-format-seconds (string seconds)
   Compatibility function replacing format-seconds.
-- 
2.0.2



Re: [O] Emacs with Org 8?

2014-07-17 Thread Nicolas Richard
SabreWolfy sabrewo...@gmail.com writes:

 The latest stable release of Emacs is 24.3.1, which does not contain Org
 version 8? Therefore, using Org 8 requires (manual) installation? I am using
 a modified version of Emacs on Mac, with ESS and other packages
 pre-installed. This version has Org 7.9.3 though :(


This is because Emacs 24.3.1 was released before Org 8 was released. Org
8 will ship with the next release, Emacs 24.4. Alternatively you can
update to Org 8 via elpa. (M-x list-packages).

Regards,

-- 
Nicolas.



Re: [O] Should C-c C-c always jump between a footnote and its definition? C-c C-x f, too?

2014-06-21 Thread Nicolas Richard
Grant Rettke g...@wisdomandwonder.com writes:

 On Fri, Jun 20, 2014 at 5:13 PM, Nicolas Goaziou m...@nicolasgoaziou.fr 
 wrote:
 I cannot reproduce it, neither on maint nor on master. Each time, cursor
 ends up on line 3898.

 Understood. Thank you much for trying.

 I will convert the document to in-line footnotes.

You tried with org 8.2.7, whereas Nicolas tried with latest maint. A
navigation bug was fixed meanwhile, so it'd be worth trying the latest
maint version before changing your data. (the bugfix isn't in 8.2.7a
unfortunately afaict).

-- 
Nico.



Re: [O] [OT] OrgMode Webpage has broken link:

2014-06-20 Thread Nicolas Richard
briangpowell . briangpowel...@gmail.com writes:

 http://orgmode.org/ - http://orgmode.org/worg/org-papers.html -
 http://orgmode.org/org-mode-documentation.html - 404 Not Found

And Bastien fixed it within 5 mins of the report. Impressive.

-- 
Nico.



Re: [O] navigation broken in recent maint

2014-06-19 Thread Nicolas Richard
Samuel Wales samolog...@gmail.com writes:

 quick and dirty bug report.  recent org maint.

I use the following patch to fix most navigation problems I encountered.
I think it will fix yours too.

more details on what the problem actually is can be found at
http://permalink.gmane.org/gmane.emacs.orgmode/87598

here's the patch :

Modified   lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index 6fb0387..d5a9380 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5484,7 +5484,9 @@ The following commands are available:
 (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
 
 (defsubst org-fix-ellipsis-at-bol ()
-  (save-excursion (set-window-start (selected-window) (window-start
+  nil
+  ;; (save-excursion (set-window-start (selected-window) (window-start)))
+  )
 
 (defun org-find-invisible-foreground ()
   (let ((candidates (remove

-- 
Nico.



[O] bug#17724: 24.4.50; regression: error `recenter'ing a window that does not display current-buffer. when opening org-mode file

2014-06-19 Thread Nicolas Richard
Gregor Zattler g...@gmx.de writes:
 like so:
 $ cd ~/src/emacs/; rm -rf * ; git co -f emacs-24
 Checking out files: 100% (3525/3525), done.
 Previous HEAD position was 0f0917d... Regenerate AUTHORS and ldefs-boot.el
 Switched to branch 'emacs-24'

(Here I am assuming emacs-24 is still checked out.) 

Could you issue git describe --tags and git branch -a --contains
HEAD ? I suspect your local emacs-24 branch isn't the actual emacs-24
branch.

(OTOH 0f0917d *does* belong to emacs-24, so there's still something
weird.)

 cd .git ; cat config
 $ cat config 
 [core]
 repositoryformatversion = 0
 filemode = true
 bare = false
 logallrefupdates = true
 [remote origin]
 url = git://git.savannah.gnu.org/emacs.git
 fetch = +refs/heads/*:refs/remotes/origin/*
 [branch master]
 remote = origin
 merge = refs/heads/master

Shouldn't there be an entry for emacs-24 here ?

-- 
Nico.





[O] bug#17724: 24.4.50; regression: error `recenter'ing a window that does not display current-buffer. when opening org-mode file

2014-06-19 Thread Nicolas Richard
Gregor Zattler telegr...@gmx.net writes:
 s$ git branch -a --contains HEAD
 * emacs-24
 master
 remotes/origin/HEAD - origin/master
 remotes/origin/master
 remotes/origin/trunk

So indeed your local emacs-24 branch points in fact to a commit from
trunk.

I think running those commands should fix the problem:
git branch -u origin/emacs-24
git reset --hard origin/emacs-24

-- 
Nico.





Re: [O] [bug?] Tramp tries to open remote file links

2014-06-18 Thread Nicolas Richard


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:
 Hello,

 When I just open an Org file that has a link to a remote file, Tramp
 tries to open it, leading to errors and timeouts when offline, at least.

It doesn't happen to me. I tried emacs -Q path/to/test.org and the
file opened normally.

Grepping, I see that tramp-maybe-open-connection is responsible for the
tramp messages. so you could eval:
(trace-function-background
 'tramp-maybe-open-connection
 *trace*
 (lambda () (with-output-to-string (backtrace

then reproduce and look into the buffer *trace* to see what called
tramp.

Call M-x untrace-function RET TAB RET to remove the tracing.

-- 
Nico.




Re: [O] [bug?] Tramp tries to open remote file links

2014-06-18 Thread Nicolas Richard


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:

   ... lots of contents...

   org-mode()

This means that org-mode calls things which in the end calls
tramp-maybe-open-connection. But what something is is in the lots of
contents part that you didn't show. Unfortunately a video isn't very
searchable.

Still, I spotted that org-element-context is called at some point, which
in turn calls org-element-link-parser, and that's what does
expand-file-name. Perhaps that would be a bug ?

-- 
Nico.




Re: [O] [bug?] Tramp tries to open remote file links

2014-06-18 Thread Nicolas Richard


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
 With it, the problem occurs; without, it does not.

Also note that this is a problem in master only ; maint has an older
version of org-display-inline-images which doesn't use org-element.

 Though, is it normal to try to open a remote PDF file while Emacs is
 unable of displaying it in the buffer (unlike PNG files, IIUC)?

Org Mode is not trying to display the PDF (at least not at that point).
The problems occurs when parsing the buffer : org-element-link-parser
uses expand-file-name to normalize the URI. Should it ? IDK. Nicolas
G might have an opinion on this.

-- 
Nico.




Re: [O] navigation broken - occur, org-babel-goto-named-src-block, etc fail

2014-06-15 Thread Nicolas Richard
Charles Berry ccbe...@ucsd.edu writes:

 Start with emacs -q, then load today's org-mode.

A glitch in 30220ff was quickly fixed in feca87b (three hours ago).
Maybe that's what you see ?

 Org-mode version 8.2.7 (release_8.2.7-1096-g23496c [...]
 GNU Emacs 24.3.1 [...]

I don't have a commit g23496c in my repo, so I can't tell if it is
affected by the problem.

-- 
Nico.



Re: [O] navigation broken - occur, org-babel-goto-named-src-block, etc fail

2014-06-15 Thread Nicolas Richard
Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 A glitch in 30220ff was quickly fixed in feca87b (three hours ago).

I meant three hours later.

-- 
Nico.



Re: [O] navigation broken - occur, org-babel-goto-named-src-block, etc fail

2014-06-15 Thread Nicolas Richard
Hello Charles,

Charles C. Berry ccbe...@ucsd.edu writes:
 On Sun, 15 Jun 2014, Nicolas Richard wrote:

 Charles Berry ccbe...@ucsd.edu writes:

 Start with emacs -q, then load today's org-mode.

 A glitch in 30220ff was quickly fixed in feca87b (three hours ago).
 Maybe that's what you see ?


 The ECM still fails.

 Did it work for you?

Unfortunately I didn't have the time to test, but it seemed very similar
to what I had experienced between these two commits, hence my suggestion
to look into them. I'll try later (and a few hours later...) M-a M-k Let me
try that now.

TL;DR: see near the end.

Ok, so here's what I think I have understood of the problem: In
org-fix-ellipsis-at-bol, we now do
(set-window-start (selected-window) (window-start))
which I thought would be a noop. But it is not, and to understand why
here's a simpler way of reproducing the funny result:

In some buffer with a few screenful of lines, when I do :
M-: (progn (forward-line 55) (set-window-start (selected-window) 
(window-start)))
(assuming point was at beginning of the buffer) I end up at line 22
(instead of 1+55 = 56) on my current frame/window configurations. (The
number 55 is chosen so that it is beyond the last line of the buffer.)

Now if I try this:
(progn (forward-line 55) (redisplay) (set-window-start (selected-window) 
(window-start)))
then it works perfectly fine.

So my conclusion is that in the first version, the command loop of emacs
doesn't redraw/recompute the window start position before the end of the
command, i.e. we have the following actions :

(progn
  ;; let's assume point is a position 1.
  (forward-line 55)
  ;; now point is at line 56, but (window-start) is still at 1.
  ;; if we used (redisplay) now, then (window-start) would be recomputed.
  (set-window-start
   (selected-window)
   (window-start)))
;; at this point, the command loop was instructed to make the window start at
;; position 1. But point is at line 56, which is out of the window,
;; hence emacs moves point to put it back in the window (namely, in its
;; center).

See (info (elisp) Window Start and End) for more info on how
set-window-start works when point ends up out of the window.

TL;DR begins here: Hence we could either use the optional arg NOFORCE
or force (redisplay) before set-window-start. Both would probably the
bug you're seeing, but I'm not sure any of those is TRT in
org-fix-ellipsis-at-bol.

(BTW if you try to fix org-fix-ellipsis-at-bol in a running emacs, be
sure to re-eval the definition of its callers because it's a defsubst
and IIUC that gets inlined automatically.)

-- 
Nico.



[O] bug#17746: bug#17746: 24.4.50; byte-code: `recenter'ing a window that does not display current-buffer. when composing a message

2014-06-13 Thread Nicolas Richard
Bastien b...@gnu.org writes:

 I've now fixed this in the maint and master branch of Org's
 repository.

Thanks for looking into it.

Perhaps this isn't the right place to ask, but I wonder how
(save-excursion (set-window-start (selected-window) (window-start)))
isn't a noop.

-- 
Nico.





[O] bug#17746: bug#17746: 24.4.50; byte-code: `recenter'ing a window that does not display current-buffer. when composing a message

2014-06-12 Thread Nicolas Richard
Daimrod daim...@gmail.com writes:
 PS: The change about throwing an error when recentering a window
 that does not display the current buffer breaks ~37 tests in Org
 master branch, even with this fix.  I need to digg this further.

 Err, what's the rational behind this change?

It is meant to catch cases where recenter acts on the wrong window.
Think of the cases where (recenter) is called from within a timer or a
process filter function.

See the discussion entitled
 comint-preoutput-filter-functions and flickering redisplay in TTY
on emacs devel.

-- 
Nico.





[O] bug#17746: 24.4.50; byte-code: `recenter'ing a window that does not display current-buffer. when composing a message

2014-06-11 Thread Nicolas Richard
Bastien b...@altern.org writes:
 PS: The change about throwing an error when recentering a window
 that does not display the current buffer breaks ~37 tests in Org
 master branch, even with this fix.  I need to digg this further.

For me, fixing also org-fix-ellipsis-at-bol made all tests run as
expected.

-- 
Nico.





[O] bug#17746: 24.4.50; byte-code: `recenter'ing a window that does not display current-buffer. when composing a message

2014-06-11 Thread Nicolas Richard
Bastien b...@altern.org writes:

 Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 Bastien b...@altern.org writes:
 PS: The change about throwing an error when recentering a window
 that does not display the current buffer breaks ~37 tests in Org
 master branch, even with this fix.  I need to digg this further.

 For me, fixing also org-fix-ellipsis-at-bol made all tests run as
 expected.

 What do you mean by fixing?  Removing it entirely?

Yes, I admit, I did : (defsubst org-fix-ellipsis-at-bol () nil)
But I must have done something wrong or misread the results because now
I see some other failures. Moreover, the backtrace that I get from make
test seems incomplete and it's not obvious to me where the recenter
call is made.

OTOH I hope that wrapping every call to recenter in a
(when (eq (current-buffer) (window-buffer))
   (recenter ...))
would fix the tests, no ?

-- 
Nico.





[O] bug#17724: 24.4.50; regression: error `recenter'ing a window that does not display current-buffer. when opening org-mode file

2014-06-10 Thread Nicolas Richard
Eli Zaretskii e...@gnu.org writes:

 From: Nicolas Richard theonewiththeevill...@yahoo.fr
 Date: Mon, 09 Jun 2014 22:53:47 +0200
 Cc: 17...@debbugs.gnu.org, Gregor Zattler g...@gmx.de
 
 FWIW, there was a call to recenter which was removed recently (less than
 four weeks ago -- see
 http://permalink.gmane.org/gmane.emacs.orgmode/86259) from org-overview.
 I guess that should fix the reported bug but it's hard to tell without a
 backtrace.

 I provided a full backtrace, C and Lisp, in my response.

Oh indeed, I should have read the whole thread.

Your backtrace confirms that it was a call from org-overview ; that was
fixed in the master branch of org mode in commit
736bc7b9047600a690a4c00c2a6510fff5044e1f. I don't know if the bug should
be closed in this siutation, so I'll leave it to someone else.

-- 
Nico.





[O] bug#17724: 24.4.50; regression: error `recenter'ing a window that does not display current-buffer. when opening org-mode file

2014-06-09 Thread Nicolas Richard
Bastien b...@altern.org writes:

 Glenn Morris r...@gnu.org writes:

 Eli Zaretskii wrote:

 Bastien, could you please look into this?

 This is like forwarding every Emacs bug to Stefan.

 I suggest instead reassigning the bug to org-mode (or emacs,org-mode),
 then simply posting a reply in the normal way. It will then go to the
 emacs-orgmode mailing list (which is where Org bugs are supposed to go).

 (I reassigned it before sending this reply.)

 Thanks to both of you, I'll look into this next week.

FWIW, there was a call to recenter which was removed recently (less than
four weeks ago -- see
http://permalink.gmane.org/gmane.emacs.orgmode/86259) from org-overview.
I guess that should fix the reported bug but it's hard to tell without a
backtrace.

There's another one in org-fix-ellipsis-at-bol which might be related
(at least it has bitten me) :

(defsubst org-fix-ellipsis-at-bol ()
  (save-excursion (goto-char (window-start)) (recenter 0)))

(I have no idea how this is supposed to fix ellipsis at bol.)

-- 
Nico.





[O] how to use :options-alist in org-export-define-derived-backend ?

2014-06-02 Thread Nicolas Richard
Hello,

I'm trying to play with the exporter but I'd like my back-end to have no
toc by default. I tried

(org-export-define-derived-backend 'mytest 'html
  :translate-alist
  ;; don't use the template, concentrate on the toc.
  (list (cons 'template (lambda (a _) a))) 
  :options-alist
  '((:with-toc nil toc nil)))

IIUC, the last nil up there should be the default value for :with-toc.
Unfortunately, exporting like this:

(with-temp-buffer
  (insert * foo\n** bar\nsome content)
  (org-export-to-buffer 'mytest *test*)
  (pop-to-buffer *test*))

will show a table of contents. Setting org-export-with-toc to nil works
as expected though :

(let ((org-export-with-toc))
  (with-temp-buffer
(insert * foo\n** bar\nsome content)
(org-export-to-buffer 'mytest *test*)
(pop-to-buffer *test*)))

What am I doing wrong ?

Thanks

-- 
Nico.



Re: [O] Bug: TAB cycling and narrowing to subtree [8.2.6 (release_8.2.6-903-ga1b4d9 @ /home/youngfrog/sources/org-mode/lisp/)]

2014-05-23 Thread Nicolas Richard
Hello Bastien,

Bastien b...@gnu.org writes:
 Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 If, instead, you first hit TAB (to open the subtree), then narrow to subtree
 and hit TAB again to fold, you get * love is followed by
 org-ellipsis followed by 'd' on the same line. The 'd' shouldn't be there.

 That's an annoying and known glitch -- I don't have time for this
 right now, but it is definitely in my radar.

 Maybe getting rid of (defadvice outline-end-of-subtree ...) in org.el
 is one way to start cleaning up that stuff.  If you can have a look,
 that'd be good.  Otherwise I will in the coming weeks.

I love the idea of cleaning, but that might require some knowledge of
the codebase that I don't have.

e.g. why does the advice exist in the first place ? IIUC,
org-end-of-subtree exists for speed reasons. Could we move the advice to
within org-end-of-subtree itself, i.e. something like:

(defun org-end-of-subtree (...)
   (if (derived-mode-p 'org-mode)
   (progn existing code)
 (outline-end-of-subtree)))

and then only call *that* function from within org.el. Code that wants
to be org-aware could use that function, code that doesn't need the
speedup in org mode shouldn't use it.

It might be more trouble than what it solves.

Another question is why does the advice use (unless (eobp)
(backward-char 1)) ? Couldn't that be moved to org-end-of-subtree itself
? Isn't that even superfluous given the 'to-heading' argument (which
could be set to nil) ? Does the test suite cover that part of org ?

Anyway, looking at the functions that get called, I spotted an easy fix.
WDYT ?

--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6729,7 +6729,10 @@ in special contexts.
(setq has-children (org-list-has-child-p (point) struct)))
(org-back-to-heading)
(setq eoh (save-excursion (outline-end-of-heading) (point)))
-   (setq eos (save-excursion (1- (org-end-of-subtree t t
+   (setq eos (save-excursion
+   (org-end-of-subtree t t)
+   (when (bolp) (backward-char))
+   (point)))
(setq has-children
  (or (save-excursion
(let ((level (funcall outline-level)))


-- 
Nico.



[O] Bug: Activating org-mode in any buffer recenters (unrelated) selected window. [8.2.6 (release_8.2.6-6-gfc37d1 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-05-14 Thread Nicolas Richard
The function `org-overview' calls `recenter' without checking if the
current buffer is actually in the currently selected window. Moreover,
turning on org-mode calls `org-overview' (I guess depending on the
configuration). IOW, turning on org-mode programmatically (e.g. via
find-file-noselect) will recenter whatever window is currently selected.
That's unexpected.

I noticed that because I recently tried org-notify, which uses
find-file-noselect, and the behaviour was very distracting to me. (Side
question : do people live with that or is it just me seeing the weird
behaviour ?)

Anyway, I would suggest to simply remove the call to recenter because I
don't understand why it's there. OTOH if it's there for a reason, then I
suggest something along the line of:
(when (eq
   (current-buffer)
   (window-buffer
(selected-window)))
  (recenter '(4)))

(but then, why the interactive-looking argument ?)

While I am at it, I don't quite understand why (goto-char) is used
*after* recenter (also, why not just save-excursion ?)

Since there are many things I obviously don't understand, I'm not
posting an actual patch but I can do that if someone wants it.

-- 
Nico.



Re: [O] [BUG] Symbol's function definition is void: function-put

2014-05-09 Thread Nicolas Richard
Sharon Kimble boudic...@skimble.plus.com writes:
 I eventually tracked it down to lines 2248 and 2284 of org-loaddefs.el
 this is line 2248
 ╭
 │(function-put 'org-export-to-buffer 'lisp-indent-function '2)
 ╰

It apparently comes from making Org with trunk and then using it with
non-trunk. See Glenn Morris' explanation here:
http://permalink.gmane.org/gmane.emacs.devel/171782

-- 
Nico.



[O] Bug: TAB cycling and narrowing to subtree [8.2.6 (release_8.2.6-903-ga1b4d9 @ /home/youngfrog/sources/org-mode/lisp/)]

2014-04-30 Thread Nicolas Richard
Hi,

With the following file named /tmp/test.org
#+BEGIN_SRC org
  ,* love is
  all you need
  ,* in the air
#+END_SRC
Run
: emacs -q -L /path/to/org/lisp/ -l org /tmp/test.org -f org-version
I get:
: Org-mode version 8.2.6 (release_8.2.6-6-gfc37d1 @ /path/to/org/lisp/)
then narrow to subtree C-x n s and hit TAB to open the subtree : the
last 'd' (of the word need) is kept hidden and replaced by
org-ellipsis.

If, instead, you first hit TAB (to open the subtree), then narrow to subtree
and hit TAB again to fold, you get * love is followed by
org-ellipsis followed by 'd' on the same line. The 'd' shouldn't be there.

Not exactly a terrible bug, but I usually find it distracting. If
org-cycle-separator-lines is non-zero it is possible to work around the
problem by adding blank lines at the end of subtrees. (It is 2 --the
default-- in the above example, but I like to set it to 0.)

IIUC, the problem amounts to the fact that TAB cycling is not working well
with buffers that don't end with a newline.

-- 
Nico.



Re: [O] how to get org-version using emacs batch mode.

2014-04-23 Thread Nicolas Richard
Supriya Sawant sp.sawan...@gmail.com writes:

 Is it possible to redirect or get the output of batch mode command in
 variable.

Assuming you use bash :

$ MYOUTPUT=$(emacs --batch --eval '(princ (org-version))')
$ echo $MYOUTPUT
8.2.5c

-- 
Nico.



Re: [O] org-open-file with xdg-open not working?

2014-04-22 Thread Nicolas Richard
Eric Abrahamsen e...@ericabrahamsen.net writes:
 Presumably that's because the gnus version (eventually
 `mm-display-external') calls xdg-open with `call-process' and org does
 it with `start-process-shell-command'. The first is synchronous, the
 second asynchronous, and I do remember seeing something on one of these
 lists about difficulties with xdg-open because the process returns
 before the file actually opens, or *doesn't* return, or some similar
 thing the details of which I'm forgetting.

 Have other people run into this difficulty? How are you solving it?

I remember having problems which I was able to solve by changing the
value of process-connection-type to nil. Does that work for you ?

-- 
Nico.



Re: [O] [RFC] Sloppy `org-element-context'?

2014-04-19 Thread Nicolas Richard
Bastien b...@gnu.org writes:
 I don't think `org-element-context' should be sloppy *at all*.

 Hope this all makes sense -- let me know what you think.

It makes sense to me, and I agree with you : org element should not
parse the syntax differently just because e.g. we put a link in a
comment and want to open it.

For comparison, AucTeX has a variable LaTeX-syntactic-comments which
controls that kind of thing : If non-nil comments will be handled
according to LaTeX syntax.

-- 
Nico.



Re: [O] The Org Package

2014-04-13 Thread Nicolas Richard
Achim Gratz strom...@nexgo.de writes:
 1. Most modern Emacs have Org pre-installed.
 2. Unfortunately, that Org is not up-to-date (24.3 has 7.9.3f).
 3. Therefore, installing the latest Org package seems natural.

 The pitfall here is that you _must_ do the first install of the Org
 package from an Emacs that didn't load any part of the built-in Org.

That's an interesting piece of information. I can't find it in (info
(org) Installation).

Just to make sure I understand it : I can imagine older macros being
byte compiled into the newer org, is that the reason ?

-- 
Nico.



Re: [O] Possible regexp bug in org.el

2014-04-01 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 here is a possible regexp bug in org.el I discovered by accident:

 ,-
 | 7734:   (and (not (looking-back ^\*+))
 `-

It's almost certainly a typo, but it introduces no bug because '*' can't
bear its special meaning after '^', so the regexp engine will make it
match exactly the '*' character. But it'd be better written as ^*+
(but this is not recommended) or, preferably, ^\\*+ indeed.

Here's the relevant manual excerpt from (info (elisp) Regexp Special) :

*Please note:* For historical compatibility, special characters are
 treated as ordinary ones if they are in contexts where their special
 meanings make no sense.  For example, `*foo' treats `*' as ordinary
 since there is no preceding expression on which the `*' can act.  It is
 poor practice to depend on this behavior; quote the special character
 anyway, regardless of where it appears.

-- 
Nico.



Re: [O] Propagating Workflow States

2014-03-31 Thread Nicolas Richard
Esben Stien b...@esben-stien.name writes:
 Any way to disable this?; it should start with TODO.

If I'm reading the docstring correctly, try C-u C-S-RET

HTH,

-- 
Nico.



Re: [O] Propagating Workflow States

2014-03-31 Thread Nicolas Richard
Esben Stien b...@esben-stien.name writes:
 C-S-RET returns: 

 C-j runs the command org-return-indent, which is an interactive
 compiled Lisp function in `org.el'.

Ah you're using non-GUI emacs. That's ok, just use C-u (that is called a
prefix argument) before whatever key chord you hit to do what you
described.

-- 
Nico.



Re: [O] preview and default class [8.2.5h (release_8.2.5h-677-g55b0a3 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-03-23 Thread Nicolas Richard
Bastien b...@gnu.org writes:
 It worked from the diff.

 I applied your patch with git apply, then went to the modified file,
 then C-x v =, then hit `n' to go to the next change and `C-x 4 a' to
 create the Changelog.

Thanks, I'll try again and hopefully find out what's wrong with what I
did.

Nico.



Re: [O] preview and default class [8.2.5h (release_8.2.5h-677-g55b0a3 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-03-22 Thread Nicolas Richard
Hello Bastien,

Bastien b...@gnu.org writes:
 Just add a missing full-stop at the end of the Changelog sentence in
 its own section.,

Done

 and perhaps use `C-x 4 a' from within the diff to
 include the section's name in the Changelog too.

I tried that in both parts of the diff, but then I get :
* org.texi (used, lines): 
(The lines 'used:' and 'lines:' appear in that file.)

I guess that's not the intended result so I left that as is.

 PS: I didn't check carefully because I don't use `C' from magit, but
 I assume magit may be wrong in creating Changelogs.  We should report
 this to magit maintainers if this is true.

In this case it seems that nothing was better than doing what C-x 4 a
did, so I didn't check further.

Here's the new patch :

From cf5246c5f44fe637cb2000cf92b2f47499d7b8d2 Mon Sep 17 00:00:00 2001
From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Thu, 6 Mar 2014 13:21:41 +0100
Subject: [PATCH] Keep documentation on Previewing LaTeX in its own section

* doc/org.texi: Keep documentation on Previewing LaTeX in its own
  section.
---
 doc/org.texi | 38 ++
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index e835022..2abfa66 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10147,19 +10147,13 @@ format sub- and superscripts in a WYSIWYM way.
 Going beyond symbols and sub- and superscripts, a full formula language is
 needed.  Org mode can contain @LaTeX{} math fragments, and it supports ways
 to process these for several export back-ends.  When exporting to @LaTeX{},
-the code is obviously left as it is.  When exporting to HTML, Org invokes the
-@uref{http://www.mathjax.org, MathJax library} (@pxref{Math formatting in
+the code is obviously left as it is.  When exporting to HTML, Org can invoke
+the @uref{http://www.mathjax.org, MathJax library} (@pxref{Math formatting in
 HTML export}) to process and display the math@footnote{If you plan to use
 this regularly or on pages with significant page views, you should install
 @file{MathJax} on your own server in order to limit the load of our server.}.
-Finally, it can also process the mathematical expressions into
-images@footnote{For this to work you need to be on a system with a working
-@LaTeX{} installation.  You also need the @file{dvipng} program or the
-@file{convert}, respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite.  The @LaTeX{} header that will be used when processing a fragment can
-be configured with the variable @code{org-format-latex-header}.} that can be
-displayed in a browser.
+It can also process the mathematical expressions into images that can be
+displayed in a browser (see @pxref{Previewing @LaTeX{} fragments}).
 
 @LaTeX{} fragments don't need any special marking at all.  The following
 snippets will be identified as @LaTeX{} source code:
@@ -10217,11 +10211,21 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have @file{dvipng} or @file{imagemagick} installed@footnote{Choose the
-converter by setting the variable
+If you have a working @LaTeX{} installation and either @file{dvipng} or
+@file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
+suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
-fragments can be processed to produce preview images of the typeset
-expressions:
+fragments can be processed to produce images of the typeset expressions to be
+used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
+or for inline previewing within Org mode.
+
+@vindex org-format-latex-options
+@vindex org-format-latex-header
+You can customize the variables @code{org-format-latex-options} and
+@code{org-format-latex-header} to influence some aspects of the preview.  In
+particular, the @code{:scale} (and for HTML export, @code{:html-scale})
+property of the former can be used to adjust the size of the preview images.
 
 @table @kbd
 @kindex C-c C-x C-l
@@ -10237,12 +10241,6 @@ process the entire buffer.
 Remove the overlay preview images.
 @end table
 
-@vindex org-format-latex-options
-You can customize the variable @code{org-format-latex-options} to influence
-some aspects of the preview.  In particular, the @code{:scale} (and for HTML
-export, @code{:html-scale}) property can be used to adjust the size of the
-preview images.
-
 @vindex org-startup-with-latex-preview
 You can turn on the previewing of all @LaTeX{} fragments in a file with
 
-- 
1.9.1



Re: [O] Bug: \uline produced inside \section in latex export [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/user/.emacs.d/elpa/org-20140303/)]

2014-03-22 Thread Nicolas Richard
Nicolas Goaziou n.goaz...@gmail.com writes:
 It is technically possible to use \underline (hard-coded) in sections
 and \uline (or whatever is defined in`org-latex-text-markup-alist')
 everywhere else.

 Is there any downside to this proposal?

Disclaimer : While I do use LaTeX, I rarely use the exporter, and never
underline in sections.

(The shed should be green, obviously.)

I don't know why \uline doesn't work, but while \underline works, it
does so with many warnings. I think the reason is that hyperref tries to
add the text to the PDF TOC (usually a pane in the pdf viewer), and that
supports very little to no formatting.

Rasmus' suggestion seemed good, i.e.
\texorpdfstring{\uline{SECTION}}{SECTION}

I'd go even a little further : assuming it makes sense to underline
within a section header, does it also make sense to propagate that
formatting to the toc and/or header of the document ? If not, I suggest
exporting as:
\section[not-so-plain text]{\uline{not-so-plain} \textbf{text}}

Also I don't know why there was underlining in the first place. If we're
asking to underline all section titles, then it might make sense to
redefine e.g. \section to do so (packages titlesec might help).

-- 
Nico.



Re: [O] preview and default class [8.2.5h (release_8.2.5h-677-g55b0a3 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-03-22 Thread Nicolas Richard
Bastien b...@gnu.org writes:
 Thanks, applied on master, with a slight change in the Changelog
 entry.

Ok thanks. For my information, did C-x 4 a work for you in adding the
section name or did you add it manually ?

-- 
Nico.



Re: [O] preview and default class [8.2.5h (release_8.2.5h-677-g55b0a3 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-03-20 Thread Nicolas Richard
Le 20/03/2014 11:55, Bastien a écrit :
 Hi Nicolas,
 
 Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 
 Here's a patch. I can commit it if you like, but I don't want to do so
 without some review (it's not as trivial a change as moving the
 corresponding footnote to the other section).
 
 I can't apply the patch, either on maint or on master, but by reading
 it carefully it looks good.

 Just add a missing full-stop at the end of the Changelog sentence in
 its own section., and perhaps use `C-x 4 a' from within the diff to
 include the section's name in the Changelog too.

Ok, I'll fix that and make sure it can be applied to master (I'm not
sure how I managed to miss that part.)

 PS: I didn't check carefully because I don't use `C' from magit, but
 I assume magit may be wrong in creating Changelogs.  We should report
 this to magit maintainers if this is true.

Indeed there usually is some difference between C (magit) and C-x 4 a. I
will have a look and report it when I get a chance.

-- 
Nico.



Re: [O] preview and default class [8.2.5h (release_8.2.5h-677-g55b0a3 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-03-19 Thread Nicolas Richard
Hi Bastien,

 Mhh, yes, I'm for moving it to the previewing section.

 Do you want to get commit access so that you can fix this directly?
 Otherwise, just send a patch and I'll apply it.

 Thanks!

Here's a patch. I can commit it if you like, but I don't want to do so
without some review (it's not as trivial a change as moving the
corresponding footnote to the other section).


From 4b431a0fc2a4df7cecd8b6649227415ed86e7f7c Mon Sep 17 00:00:00 2001
From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Wed, 19 Mar 2014 23:13:39 +0100
Subject: [PATCH] Keep documentation on Previewing LaTeX in its own section

* doc/org.texi: Keep documentation on Previewing LaTeX in its own
  section
---
 doc/org.texi | 39 ++-
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index c442f83..447cde9 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10140,19 +10140,13 @@ format sub- and superscripts in a WYSIWYM way.
 Going beyond symbols and sub- and superscripts, a full formula language is
 needed.  Org mode can contain @LaTeX{} math fragments, and it supports ways
 to process these for several export back-ends.  When exporting to @LaTeX{},
-the code is obviously left as it is.  When exporting to HTML, Org invokes the
-@uref{http://www.mathjax.org, MathJax library} (@pxref{Math formatting in
+the code is obviously left as it is.  When exporting to HTML, Org can invoke
+the @uref{http://www.mathjax.org, MathJax library} (@pxref{Math formatting in
 HTML export}) to process and display the math@footnote{If you plan to use
 this regularly or on pages with significant page views, you should install
 @file{MathJax} on your own server in order to limit the load of our server.}.
-Finally, it can also process the mathematical expressions into
-images@footnote{For this to work you need to be on a system with a working
-@LaTeX{} installation.  You also need the @file{dvipng} program or the
-@file{convert}, respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite.  The @LaTeX{} header that will be used when processing a fragment can
-be configured with the variable @code{org-format-latex-header}.} that can be
-displayed in a browser.
+It can also process the mathematical expressions into images that can be
+displayed in a browser (see @pxref{Previewing @LaTeX{} fragments}).
 
 @LaTeX{} fragments don't need any special marking at all.  The following
 snippets will be identified as @LaTeX{} source code:
@@ -10210,11 +10204,21 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have @file{dvipng} or @file{imagemagick} installed@footnote{Choose the
-converter by setting the variable
+If you have a working @LaTeX{} installation and either @file{dvipng} or
+@file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
+suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
-fragments can be processed to produce preview images of the typeset
-expressions:
+fragments can be processed to produce images of the typeset expressions to be
+used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
+or for inline previewing within Org mode.
+
+@vindex org-format-latex-options
+@vindex org-format-latex-header
+You can customize the variables @code{org-format-latex-options} and
+@code{org-format-latex-header} to influence some aspects of the preview.  In
+particular, the @code{:scale} (and for HTML export, @code{:html-scale})
+property of the former can be used to adjust the size of the preview images.
 
 @table @kbd
 @kindex C-c C-x C-l
@@ -10230,13 +10234,6 @@ process the entire buffer.
 Remove the overlay preview images.
 @end table
 
-@vindex org-format-latex-options
-@vindex org-format-latex-header
-You can customize the variables @code{org-format-latex-options} and
-@code{org-format-latex-header} to influence some aspects of the preview.  In
-particular, the @code{:scale} (and for HTML export, @code{:html-scale})
-property of the former can be used to adjust the size of the preview images.
-
 @vindex org-startup-with-latex-preview
 You can turn on the previewing of all @LaTeX{} fragments in a file with
 
-- 
1.9.1



Re: [O] Bug: org-element-parse-buffer doesn't work in 8.2.5h [8.2.5h (8.2.5h-30-gdd810b-elpa @ /home/sindikat/.emacs.d/elpa/org-20140303/)]

2014-03-14 Thread Nicolas Richard
sindi...@mail36.net (sindi...@mail36.net) writes:
 It was reproduced on clean Emacs by running `emacs -Q' and issuing:

 (let ((package-load-list '((org t
   (package-initialize))

Could you show us the output of M-x org-version in that emacs -Q
session ? Could you also try M-x org-reload after you ran the above
lisp ? What is the output of (locate-library org-compat) ? What's the
output of M-:
(delq nil
  (mapcar
   (lambda (elt)
 (when
 (and (stringp (car elt))
  (string-match org-compat (car elt)))
   (car elt)))
   load-history)) ?

FWIW I couldn't repro either with the following recipe:
$ REPO=gnu emacs -f package-refresh-contents --eval '(package-install (cadr 
(assoc (quote org) package-archive-contents)))'

with an empty ~/.emacs

-- 
Nico.



Re: [O] Remove redundant tags of headlines

2014-03-14 Thread Nicolas Richard


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
 I tried Edebugging it, but Edebug does not jump into the execution of
 the anonymous function...

edebug can only jump to the anonymous function if it knows that it is a
function, which means : don't quote the lambda (or quote using #'). I
fixed it on worg.

(btw, I noticed that worg says
remote: No such file: 
/home/emacs/git/worg/org-tutorials/../code/awk/ical2org.awk src awk
when I push to it. I *guess* it comes from
org-tutorials/org-google-sync.org which tries to #+INCLUDE the above,
but I'm unsure how to fix it. I didn't touch that file.)

-- 
Nico.




Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-13 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 Ok, I see ...  that seems to be a common pattern in Org-mode to make
 functions behave differently if called (non-)interactively, that
 sometimes causes confusion when using M-: instead of M-x.

Note that using M-: will always hide any (message foo) might have
been called because M-: outputs the return value of the function.
Usually you can recover those by inspecting the *Messages* buffer, but
in this case org uses org-unlogged-message so you can't see it there
either.

Try this :
M-: (prog1 (org-display-outline-path) (sit-for 2)) RET
It shows the message (for up to 2 seconds), and then it is hidden by the
return value (a string with properties) when the call to M-: terminates.

-- 
Nico.



Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-13 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 only that promptly another message is shown (I can't use sit-for in
 the program):

sit-for was just to demonstrate the problem introduced solely by M-:.
That problem is not present when using interactive commands (i.e. those
a user can actually use), and no sit-for should be necessary in all
pratical situations.

 ,-
 | Wrote /home/my/tmpdir/myfile
 `-

Obviously you should find out what's writing to that file after your
(message ...) statement. I'm not an outshine/outorg user, I have no idea
what does it.

-- 
Nico.



[O] preview and default class [8.2.5h (release_8.2.5h-677-g55b0a3 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-03-06 Thread Nicolas Richard
Hello,

I was a little bit surprised that previewing latex fragments doesn't use
the same class as latex export. That's contrary to my expectation but I
don't know how to fix it. The reason I expected that is : I set a
default (personnal) latex class which defines many commands that I use
everyday when writing latex, and thus also when writing latex in org
documents.

Also, it took me a lot of time to find out that org-format-latex-header
was used for previewing latex fragments. I suggest that we mention it in
the manual in (info (org) Previewing LaTeX fragments). It's already
mentionned in (info (org) LaTeX fragments) in a footnote, but I think
the variable must be found in the Previewing section too.

Here's a patch to do it, but maybe the whole footnote should be moved to
the Previewing section instead ?

From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Thu, 6 Mar 2014 13:21:41 +0100
Subject: [PATCH] * doc/org.texi: mention org-format-latex-header near
 org-format-latex-options

---
 doc/org.texi | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 7e66034..b85f8c0 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10228,10 +10228,11 @@ Remove the overlay preview images.
 @end table
 
 @vindex org-format-latex-options
-You can customize the variable @code{org-format-latex-options} to influence
-some aspects of the preview.  In particular, the @code{:scale} (and for HTML
-export, @code{:html-scale}) property can be used to adjust the size of the
-preview images.
+@vindex org-format-latex-header
+You can customize the variables @code{org-format-latex-options} and
+@code{org-format-latex-header} to influence some aspects of the preview.  In
+particular, the @code{:scale} (and for HTML export, @code{:html-scale})
+property of the former can be used to adjust the size of the preview images.
 
 @vindex org-startup-with-latex-preview
 You can turn on the previewing of all @LaTeX{} fragments in a file with
-- 
1.8.5.2




Re: [O] org-element-context doesn't parse consistently link with spaces

2014-03-05 Thread Nicolas Richard
Bastien b...@gnu.org writes:

 Daimrod daim...@gmail.com writes:

 Awww that's tricky, M-x org-version doesn't have the same behavior than
 M-: (org-version)

 That's on purpose: (org-version) is what you want to call in a
 program, hence the short version, while M-x org-version RET is what
 you want to call interactively (hence the longer one.)

I tried (org-version t) C-x C-e but it inserted nothing. Looking at the
code, I'd suggest the following patch.

OTOH, I find it a bad idea that some arguments are ignored in
non-interactive uses, it'd be better to have a function which fully
obeys its arguments, and has an interactive spec which sets the
argument. If you're interested I can do that.


From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Wed, 5 Mar 2014 16:38:58 +0100
Subject: [PATCH] org.el (org-version): mention that HERE is ignored in
 non-interactive uses.

---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 64ee668..5c1b61e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -298,7 +298,8 @@ identifier.
 ;;;###autoload
 (defun org-version (optional here full message)
   Show the org-mode version in the echo area.
-With prefix argument HERE, insert it at point.
+With prefix argument HERE (this is ignored in non-interactive
+uses), insert it at point.
 When FULL is non-nil, use a verbose version string.
 When MESSAGE is non-nil, display a message with the version.
   (interactive P)
-- 
1.8.3.2



[O] Bug: [patch] also tangle headlines that begin with lower case string comment [8.2.5h (release_8.2.5h-680-g12df70 @ /home/youngfrog/sources/org-mode/lisp/)]

2014-03-05 Thread Nicolas Richard
Hi,

Trying to tangle code blocks in a headline line like:
#+begin_src org
  ,* Comment retrouver
#+end_src
I struggled to understand what I was doing wrong because it didn't
tangle anything. In fact, the french word Comment was mistakenly
parsed as the org-comment-string, and so the headline was skipped. Let's
avoid that (see patch below).

I take the opportuinty to ask if we should try and make this function
use org-element instead.

My naïve approach doesn't work:
#+begin_src emacs-lisp
  (save-excursion
(org-back-to-heading t)
(let ((elt (org-element-at-point)))
  (while (and elt
  (not
   (org-element-property :commentedp elt)))
(setq elt
  (org-element-property :parent elt)))
  elt))
#+end_src
because an heading doesn't know what its parent heading is (the property
is nil). This can be fixed by doing:
#+begin_src emacs-lisp
(defun org-babel-under-commented-heading-p ()
  Return t if currently under a commented heading.
  (unless (org-before-first-heading-p)
(save-excursion
  (org-back-to-heading t)
  (let ((elt (org-element-at-point)))
(while (and elt
(not
 (org-element-property :commentedp elt)))
  (setq elt
(and (org-up-heading-safe)
 (org-element-at-point
elt
#+end_src

byt I'm not sure it is very pretty. Opinions ?

Anyway, here's the quicker fix :

From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Wed, 5 Mar 2014 14:54:49 +0100
Subject: [PATCH] * ob-tangle.el (org-babel-under-commented-heading-p): Disable
 case folding to avoid matching Comment at beg of headline.

---
 lisp/ob-tangle.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 0096ac9..9f0ea0d 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -361,7 +361,8 @@ that the appropriate major-mode is set.  SPEC has the form:
   Return t if currently under a commented heading.
   (unless (org-before-first-heading-p)
 (if (let ((hd (nth 4 (org-heading-components
- (and hd (string-match (concat ^ org-comment-string) hd)))
+ (and hd (let (case-fold-search)
+   (string-match (concat ^ org-comment-string) hd
t
   (save-excursion
(and (org-up-heading-safe)

-- 
Nico.



[O] Bug: add elisp to org-babel-tangle-lang-exts to support elisp source blocks [8.2.5h (release_8.2.5h-680-g12df70 @ /home/youngfrog/sources/org-mode/lisp/)]

2014-03-05 Thread Nicolas Richard
Hello,

elisp (vs emacs-lisp) code blocks are supported via an entry
org-src-lang-modes but not in org-babel-tangle-lang-exts.

The patch below is to fix that.

From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Wed, 5 Mar 2014 16:49:30 +0100
Subject: [PATCH] lisp/ob-tangle.el: elisp should get tangled to .el files.

---
 lisp/ob-tangle.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 5797ea4..8923e16 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -41,7 +41,8 @@
 (declare-function org-before-first-heading-p org ())
 
 (defcustom org-babel-tangle-lang-exts
-  '((emacs-lisp . el))
+  '((emacs-lisp . el)
+(elisp . el))
   Alist mapping languages to their file extensions.
 The key is the language name, the value is the string that should
 be inserted as the extension commonly used to identify files
-- 
1.8.3.2



Re: [O] org-element-context doesn't parse consistently link with spaces

2014-03-05 Thread Nicolas Richard
Bastien b...@gnu.org writes:

 Hi Nicolas,

 Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 OTOH, I find it a bad idea that some arguments are ignored in
 non-interactive uses, it'd be better to have a function which fully
 obeys its arguments, and has an interactive spec which sets the
 argument. If you're interested I can do that.

 Of course I'm interested, thanks in advance!

Could you review this ? thanks.

From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Wed, 5 Mar 2014 17:25:45 +0100
Subject: [PATCH] lisp/org.el (org-version): obey all arguments in
 non-interactive uses.

---
 lisp/org.el | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5c1b61e..11184cc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -297,12 +297,11 @@ identifier.
 
 ;;;###autoload
 (defun org-version (optional here full message)
-  Show the org-mode version in the echo area.
-With prefix argument HERE (this is ignored in non-interactive
-uses), insert it at point.
-When FULL is non-nil, use a verbose version string.
-When MESSAGE is non-nil, display a message with the version.
-  (interactive P)
+  Show the org-mode version.
+Interactively, or when MESSAGE is non-nil, show it in echo area.
+With prefix argument, or when HERE is non-nil, insert it at point.
+In non-interactive uses, a reduced version string is output unless FULL is 
given.
+  (interactive (list current-prefix-arg t (not current-prefix-arg)))
   (let* ((org-dir (ignore-errors (org-find-library-dir org)))
 (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes))
 (load-suffixes (list .el))
@@ -322,12 +321,12 @@ When MESSAGE is non-nil, display a message with the 
version.
(concat mixed installation!  org-install-dir 
 and  org-dir))
org-loaddefs.el can not be found!)))
 (version1 (if full version org-version)))
-(if (org-called-interactively-p 'interactive)
-   (if here
-   (insert version)
- (message version))
-  (if message (message version1))
-  version1)))
+(when here (insert version1))
+(when message (message %s version1))
+version1))
+
+
+
 
 (defconst org-version (org-version))
 
-- 
1.8.3.2



Re: [O] Bug: [patch] also tangle headlines that begin with lower case string comment [8.2.5h (release_8.2.5h-680-g12df70 @ /home/youngfrog/sources/org-mode/lisp/)]

2014-03-05 Thread Nicolas Richard
Hi Nicolas,

Nicolas Goaziou n.goaz...@gmail.com writes:
 Of course, `org-element-at-point' can parse headlines, but if speed is
 a factor, since headline syntax is not context-dependent, it is often
 worth considering using regexps.

I don't know if speed is terribly important here, but since my suggested
approach uses a loop instead of recursion, it ends up being faster for
nested headlines (more than 5 levels). This obviously could be fixed in
the initial approach too.

Since we know where point is, we could also use
(org-element-headline-parser nil t) instead of (org-element-at-point).
That's a tiny bit faster.

For those interested, here's timing info:
(progn
  (defun yf/org-babel-under-commented-heading-p ()
Return t if currently under a commented heading.
(unless (org-before-first-heading-p)
  (save-excursion
(org-back-to-heading t)
(let ((elt (org-element-headline-parser nil t)))
  (while (and elt
  (not
   (org-element-property :commentedp elt)))
(setq elt
  (and (org-up-heading-safe)
   (org-element-headline-parser nil t
  elt
  (elp-instrument-list
   '(org-babel-under-commented-heading-p
 yf/org-babel-under-commented-heading-p))
  (let ((org-element-use-cache t))
(with-temp-buffer
  (insert * foo bar
** bal
*** bal
 bal
* bal
** bal
*** bal
 bal
* bal
** bal
*** bal
 bal
* bal
** bal)
  (org-mode)
  (goto-char (point-min))
  (forward-line 4) ;; - 0 for top level, etc.
  ;; (profiler-reset)
  (let ((n 100))
(garbage-collect)
(dotimes
(_ n)
  (org-babel-under-commented-heading-p))
(dotimes
(_ n)
  (yf/org-babel-under-commented-heading-p))
(elp-results)
)
  ;; (profiler-report)
  )))

But as I said, I don't think speed matters much for this specific function.

 Also, don't forget `org-with-limited-levels' when you need to tell
 a headline from an inlinetask.

I have absolutely no idea if this is important here.

-- 
Nicolas.



Re: [O] Bug: [patch] also tangle headlines that begin with lower case string comment [8.2.5h (release_8.2.5h-680-g12df70 @ /home/youngfrog/sources/org-mode/lisp/)]

2014-03-05 Thread Nicolas Richard
Hi Nicolas,

Nicolas Goaziou n.goaz...@gmail.com writes:
 Of course, `org-element-at-point' can parse headlines, but if speed is
 a factor, since headline syntax is not context-dependent, it is often
 worth considering using regexps.

I don't know if speed is terribly important here, but since my suggested
approach uses a loop instead of recursion, it ends up being faster for
nested headlines (more than 5 levels). This obviously could be fixed in
the initial approach too.

Since we know where point is, we could also use
(org-element-headline-parser nil t) instead of (org-element-at-point).
That's a tiny bit faster.

For those interested, here's timing info:
(progn
  (defun yf/org-babel-under-commented-heading-p ()
Return t if currently under a commented heading.
(unless (org-before-first-heading-p)
  (save-excursion
(org-back-to-heading t)
(let ((elt (org-element-headline-parser nil t)))
  (while (and elt
  (not
   (org-element-property :commentedp elt)))
(setq elt
  (and (org-up-heading-safe)
   (org-element-headline-parser nil t
  elt
  (elp-instrument-list
   '(org-babel-under-commented-heading-p
 yf/org-babel-under-commented-heading-p))
  (let ((org-element-use-cache t))
(with-temp-buffer
  (insert * foo bar
** bal
*** bal
 bal
* bal
** bal
*** bal
 bal
* bal
** bal
*** bal
 bal
* bal
** bal)
  (org-mode)
  (goto-char (point-min))
  (forward-line 4) ;; - 0 for top level, etc.
  ;; (profiler-reset)
  (let ((n 100))
(garbage-collect)
(dotimes
(_ n)
  (org-babel-under-commented-heading-p))
(dotimes
(_ n)
  (yf/org-babel-under-commented-heading-p))
(elp-results)
)
  ;; (profiler-report)
  )))

 Also, don't forget `org-with-limited-levels' when you need to tell
 a headline from an inlinetask.

I have absolutely no idea if this is important here.

-- 
Nicolas.



Re: [O] Bug: open date in SCHEDULED: lines [8.2.5h (release_8.2.5h-662-ge4a955 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-02-26 Thread Nicolas Richard
Le 25/02/2014 17:52, Nicolas Goaziou a écrit :
 Nicolas Richard theonewiththeevill...@yahoo.fr writes:
 Starting with fc9ce86cfc1ecf7e86028027a12875a26500e774, hitting C-c C-o
 on a timestamp in a SCHEDULED: line doesn't work anymore (No link
 found). I expected it to open the agenda like it does on other links.
 
 This should be fixed. Thank you for reporting it.

It indeed is, thanks.

-- 
N.R.




Re: [O] [ANN] Lazy cache synchronization

2014-02-26 Thread Nicolas Richard
Nicolas Goaziou n.goaz...@gmail.com writes:
 Now, synchronization happens lazily, which means the cache is only
 updated when and where needed, or during idle time. Therefore the cache
 mechanism scales a lot better.

This seems to be an awesome news ! I can hardly believe you manage to
find the time to do this.

I'm sorry that this is only a thank you message (vs, e.g., actual work
from me in the directions you suggest), it certainly deserves more than
that, but I'd find it sad if it had no answer at all.

-- 
Nico.



[O] Bug: open date in SCHEDULED: lines [8.2.5h (release_8.2.5h-662-ge4a955 @ /home/youngfrog/sourcetrees/org-mode/lisp/)]

2014-02-25 Thread Nicolas Richard
Hiya,

Starting with fc9ce86cfc1ecf7e86028027a12875a26500e774, hitting C-c C-o
on a timestamp in a SCHEDULED: line doesn't work anymore (No link
found). I expected it to open the agenda like it does on other links.

Here's a test case:
emacs -Q -L lisp/ ~/tmp/test.org -f forward-line -f forward-line -f 
org-end-of-line -f backward-char -f org-open-at-point
where test.org is this :
#+STARTUP: showeverything
* blam
  SCHEDULED: 2014-02-25 mar

Thanks,

Emacs  : GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.20)
 of 2014-01-30 on LDLC-portable
Package: Org-mode version 8.2.5h (release_8.2.5h-662-ge4a955 @ 
/home/youngfrog/sourcetrees/org-mode/lisp/)


Re: [O] for your amusement

2014-02-20 Thread Nicolas Richard
[fu2 gmane.emacs.bbdb.user]

Eric Abrahamsen e...@ericabrahamsen.net writes:
 Incidentally, I'm using `ido-everywhere', and would like to write this
 function so that it didn't _rely_ on ido, but made use of ido when
 `ido-everywhere' was true. Ie, I'd like to replace the
 `ido-completing-read' calls with something more generic that still made
 use of ido when it was turned on. Any suggestions?

ido-everywhere is only meant for buffer/file (see its docstring). People
who really want ido everywhere should probably use ido-ubiquitous which
sets completing-read-function to ido-completing-read (in fact, a wrapper
around it because it cannot handle all cases that completing-read should
handle).

Hence, my suggestion would be to use completing-read instead of
ido-completing-read in your code, and configure ido-ubiquitous
(available from marmalade and melpa) for controlling what to use.

Related package : ido-hacks (which also enables ido in more places)

I *guess* it'll then also work automagically with icomplete-mode
(shipped with recent emacs) if that is what the user enable instead of
ido-ubiquitous.

-- 
Nico.




Re: [O] for your amusement

2014-02-20 Thread Nicolas Richard
Eric Abrahamsen e...@ericabrahamsen.net writes:
 Gosh, where did you guys dig this thread up from? :)

Oops, I didn't notice the date of your original message. I answered
because of Kevin's answer.

-- 
Nico.




Re: [O] simple way to call `C-c a v' or a way to bind it to a key?

2014-02-17 Thread Nicolas Richard
Marc Ihm m...@ihm.name writes:
 (global-set-key (kbd f12) (lambda () (interactive) (execute-kbd-macro 
 (kbd C-c a v

(global-set-key (kbd f12) (kbd C-c a v))

might be a little easier to read and type. Explanation is :
global-set-key can take any command as argument, and the definition of
what a command is includes keyboard macros. That is vaguely explained
at (info (elisp) What Is a Function) -- 2nd paragraph after the term
command.

 P.s.: In my opinion, the name execute-kbd-macro of this builtin function is 
 somewhat misleading;
 replay-keys describes this usage closer ...

I think I wouldn't look for replay-keys if I did not know about the
function. My own problem is that I usually look for call-kbd-macro,
which doesn't exist, instead of execute- I guess everyone can't be
pleased !

-- 
Nico.



[O] renaming of ob-sh to ob-shell

2014-02-01 Thread Nicolas Richard
Hello,

The commit 80754a8 says updated names in test-ob-shell but it
reintroduced the file test-ob-sh.el which was renamed in the parent of
that commit.

I attach a patch which changs that and various other things related to
the renaming, namely : the customize interface, the README, and a change
in org-test (the one mentionned in 87a9et6mzz@gmail.com I guess).

From 8351ad5f1b94ba0ca7768a1d765df1248645fbf4 Mon Sep 17 00:00:00 2001
From: Nicolas Richard theonewiththeevill...@yahoo.fr
Date: Fri, 31 Jan 2014 17:02:03 +0100
Subject: [PATCH] Renaming of ob-sh to ob-shell: various fixes

* lisp/org.el (org-babel-load-languages):
* testing/org-test.el:
* testing/README: change 'sh' to 'shell'

* testing/lisp/test-ob-sh.el: re-rename test file (fixes 80754a8)
---
 lisp/org.el   |  2 +-
 testing/README|  2 +-
 testing/lisp/test-ob-sh.el| 52 ---
 testing/lisp/test-ob-shell.el | 15 +++--
 testing/org-test.el   |  2 +-
 5 files changed, 11 insertions(+), 62 deletions(-)
 delete mode 100644 testing/lisp/test-ob-sh.el

diff --git a/lisp/org.el b/lisp/org.el
index 20dcb92..5158678 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -275,7 +275,7 @@ requirements) is loaded.
 		 (const :tag Scala scala)
 		 (const :tag Scheme scheme)
 		 (const :tag Screen screen)
-		 (const :tag Shell Script sh)
+		 (const :tag Shell Script shell)
 		 (const :tag Shen shen)
 		 (const :tag Sql sql)
 		 (const :tag Sqlite sqlite)
diff --git a/testing/README b/testing/README
index e25a109..c7e352b 100644
--- a/testing/README
+++ b/testing/README
@@ -24,7 +24,7 @@ Also note that many of the current tests uses babel evaluation...
 -l lisp/org-id.el -l testing/org-test.el \
 --eval (progn (org-reload) (setq org-confirm-babel-evaluate nil) \
 (org-babel-do-load-languages 'org-babel-load-languages \
-'((emacs-lisp . t) (sh . t) (org . t \
+'((emacs-lisp . t) (shell . t) (org . t \
 -f org-test-run-batch-tests
 #+END_SRC
 
diff --git a/testing/lisp/test-ob-sh.el b/testing/lisp/test-ob-sh.el
deleted file mode 100644
index 09278e7..000
--- a/testing/lisp/test-ob-sh.el
+++ /dev/null
@@ -1,52 +0,0 @@
-;;; test-ob-shell.el
-
-;; Copyright (c) 2010-2014 Eric Schulte
-;; Authors: Eric Schulte
-
-;; This file is not part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see http://www.gnu.org/licenses/.
-
-;;; Comment:
-
-;; Template test file for Org-mode tests
-
-;;; Code:
-(org-test-for-executable sh)
-(unless (featurep 'ob-shell)
-  (signal 'missing-test-dependency Support for Shell code blocks))
-
-(ert-deftest test-ob-shell/dont-insert-spaces-on-expanded-bodies ()
-  Expanded shell bodies should not start with a blank line
-unless the body of the tangled block does.
-  (should-not (string-match ^[\n\r][\t ]*[\n\r]
-			(org-babel-expand-body:generic echo 2 '(
-  (should (string-match ^[\n\r][\t ]*[\n\r]
-			(org-babel-expand-body:generic \n\necho 2 '()
-
-(ert-deftest test-ob-shell/dont-error-on-empty-results ()
-  Was throwing an elisp error when shell blocks threw errors and
-returned empty results.
-  (should (null (org-babel-execute:sh ls NoSuchFileOrDirectory.txt nil
-
-(ert-deftest test-ob-shell/session ()
-  This also tests `org-babel-comint-with-output' in
-ob-comint.el, which was not previously tested.
-  (let ((res (org-babel-execute:sh echo 1; echo 2 '((:session . yes)
-(should res)
-(should (listp res
-
-(provide 'test-ob-shell)
-
-;;; test-ob-shell.el ends here
diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 87e2a95..2b3e48f 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -1,4 +1,4 @@
-;;; test-ob-sh.el
+;;; test-ob-shell.el
 
 ;; Copyright (c) 2010-2014 Eric Schulte
 ;; Authors: Eric Schulte
@@ -25,9 +25,9 @@
 ;;; Code:
 (org-test-for-executable sh)
 (unless (featurep 'ob-shell)
-  (signal 'missing-test-dependency Support for Sh code blocks))
+  (signal 'missing-test-dependency Support for Shell code blocks))
 
-(ert-deftest test-ob-sh/dont-insert-spaces-on-expanded-bodies ()
+(ert-deftest test-ob-shell/dont-insert-spaces-on-expanded-bodies ()
   Expanded shell bodies should not start with a blank line
 unless the body of the tangled block does.
   (should-not (string-match ^[\n\r][\t ]*[\n\r]
@@ -35,18 +35,19

  1   2   >