[O] [BUG] Org manual without correct org-version

2018-04-12 Thread Vladimir Lomov
Hello,
I'm using org-mode from git and found that now it is not show the
'git' version but simply 9.1 in Info file. In doc/ there is
'org-version.inc', it is included into 'orgguide.texi' but not in
'org.texi'.

As I understand the 'org.texi' is generated from 'org-manual.org', so
'org-manual.org' should either somehow includes that file or provide
other way to get version information.

P.S. I'm practially do the following:
1. git clone/"update" to/the local repo;
2. byte-compile the files;
3. make a package (for my distro).

---
WBR, Vladimir Lomov

-- 
Sattinger's Law:
It works better if you plug it in.



Re: [O] How to set org-make-link-description-function

2018-04-12 Thread John Kitchin
Not with the way I wrote it. It should only affect your links and pass
everything else through I think.

On Thu, Apr 12, 2018 at 9:15 PM Eric Abrahamsen 
wrote:

> John Kitchin  writes:
>
> > I don't know how to do that either. It does seem like you can set it
> globally. You can try something
> > like:
> >
> > #+BEGIN_SRC emacs-lisp
> > (setq org-make-link-description-function
> >   (lambda (link desc)
> > (cond
> > ((s-starts-with? "ebdb:uuid/" link)
> >   (replace-regexp-in-string "ebdb:uuid/" "" link))
> > (t
> >   desc
> > #+END_SRC
> >
> > It doesn't seem too ideal, as it seems like something that should get
> > set in the link parameters
>
> Right, setting it globally doesn't seem feasible at all, it would just
> be clobbering left and right...
>
>
> --
John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


Re: [O] How to set org-make-link-description-function

2018-04-12 Thread Eric Abrahamsen
John Kitchin  writes:

> I don't know how to do that either. It does seem like you can set it 
> globally. You can try something
> like:
>
> #+BEGIN_SRC emacs-lisp
> (setq org-make-link-description-function
>   (lambda (link desc)
> (cond
> ((s-starts-with? "ebdb:uuid/" link)
>   (replace-regexp-in-string "ebdb:uuid/" "" link))
> (t
>   desc
> #+END_SRC
>
> It doesn't seem too ideal, as it seems like something that should get
> set in the link parameters

Right, setting it globally doesn't seem feasible at all, it would just
be clobbering left and right...




Re: [O] [PATCH] org-capture: Add a custom to control save target file or not.

2018-04-12 Thread tumashu










At 2018-04-12 21:22:21, "Nicolas Goaziou"  wrote:
>Hello,
>
>tumashu  writes:
>
>> I use org-capture to capture text to a file of my mobile phone
>> with the help of tramp and termux's sshd, the save buffer is very
>> slow, so I want to org-capture-finalize just update buffer, and
>> I save buffer manually when need.
>
>Thank you. Comments follow.
>
>> By the way, can we contribute org-mode with the help of PR feature in
>> code.orgmode.org?
>
>AFAIC, I'd rather deal with email than with a web interface. However,
>Bastien accepted PR from code.orgmode.org in the past.
>
>The problem with PR in code.orgmode.org is that the discussion around
>the patch happens somewhere else than on the ML.
>
>> +(defcustom org-capture-finalize-save-buffer t
>> +  "When nil, org-capture-finalize will not save target file's buffer."
>> +  :group 'org-capture
>> +  :version "24.1"
>> +  :type 'boolean)
>
>The :version value is incorrect. Also, it is missing ":safe #'booleanp".
>

:version 26.1 ? or 27.0 ?


>>  (defcustom org-capture-bookmark t
>>"When non-nil, add a bookmark pointing at the last stored
>>  position when capturing."
>> @@ -791,7 +797,10 @@ captured item after finalizing."
>>  (org-encrypt-entry)))
>>  
>>  ;; Kill the indirect buffer
>> -(save-buffer)
>> +(if org-capture-finalize-save-buffer
>> +(save-buffer)
>> +  (message "The capture target file is not auto saved, please save it 
>> manually."))
>
>Would it make sense to simply not call `save-buffer' in all cases?
>Saving buffer after a capture is rather opinionated.

I do not know why must save-buffer, may be for  information safe :-)

>
>
>Regards,
>
>-- 
>Nicolas Goaziou


Re: [O] How to set org-make-link-description-function

2018-04-12 Thread John Kitchin
I don't know how to do that either. It does seem like you can set it
globally. You can try something like:

#+BEGIN_SRC emacs-lisp
(setq org-make-link-description-function
  (lambda (link desc)
(cond
((s-starts-with? "ebdb:uuid/" link)
  (replace-regexp-in-string "ebdb:uuid/" "" link))
(t
  desc
#+END_SRC

It doesn't seem too ideal, as it seems like something that should get set
in the link parameters.

Does anyone else have an idea?

John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Thu, Apr 12, 2018 at 5:54 PM, Eric Abrahamsen 
wrote:

> I've coded Org link support for EBDB, a contact management package,
> where the :complete key looks like:
>
> (lambda ()
>   (format "ebdb:uuid/%s"
>   (ebdb-record-uuid
>(ebdb-prompt-for-record
> (ebdb-records)
>
> Which prompts for a record based on the contact name, then inserts the
> contact's UUID as the link.
>
> The problem is that Org then prompts for a link description. I'd like to
> provide the contact name as a default description (the user has just
> typed it in, after all), but haven't figured out how to do that.
>
> Clearly `org-make-link-description-function' is meant to play this role,
> and it would work perfectly, but I don't know to set it. I can't set it
> globally, but also don't know how to let-bind it locally.
>
> How am I supposed to use it?
>
> Thanks,
> Eric
>
>
>


[O] How to set org-make-link-description-function

2018-04-12 Thread Eric Abrahamsen
I've coded Org link support for EBDB, a contact management package,
where the :complete key looks like:

(lambda ()
  (format "ebdb:uuid/%s"
  (ebdb-record-uuid
   (ebdb-prompt-for-record
(ebdb-records)

Which prompts for a record based on the contact name, then inserts the
contact's UUID as the link.

The problem is that Org then prompts for a link description. I'd like to
provide the contact name as a default description (the user has just
typed it in, after all), but haven't figured out how to do that.

Clearly `org-make-link-description-function' is meant to play this role,
and it would work perfectly, but I don't know to set it. I can't set it
globally, but also don't know how to let-bind it locally.

How am I supposed to use it?

Thanks,
Eric




Re: [O] How to display babel src block language on exported PDF code block?

2018-04-12 Thread stardiviner
I recently switched email client from Thunderbird to 
mu4e+getmail+procmail. Found missed many my related messages because my 
wrong procmail rules. Missed this too. I found on Thunderbird again.



On 04/06/2018 11:32 AM, John Kitchin wrote:

I have done soemthing like this before:

;; custom exporter
(org-export-define-derived-backend 'my-latex 'latex
  :translate-alist '((src-block . my-src-block)))

(org-export-to-file 'my-latex "manuscript.tex" nil nil nil nil nil)
(ox-manuscript-latex-pdf-process "manuscript.tex")


Is it possible to not manually export file, I want it is integrated into 
Org-mode [C-c C-e l] seamlessly. Do I have to inherit `'latex` backend 
and create a new variant `'my-latex' backend? then export manually? 
Maybe use some kind of modification of default list values to replace or 
append?

What do you think?



John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Thu, Apr 5, 2018 at 7:01 PM, stardiviner > wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

By default org-mode export to PDF file does not have language
indicator on code block.
How to setup to add a language string on exported PDF code block
like this HTML https://stardiviner.github.io/ ?
- --
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

-BEGIN PGP SIGNATURE-

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrG1RIACgkQG13xyVro
msP0UQf/aPrlTV1ZreOrTmKuqo9rA28u/vtX266EtmOFOwB/y50pazkT5YdFLHKW
HUGyFFrWxBtTTCA9KW6/OJ49AB6kXoHSdj98jyCkRroroaT9mqtWdY9Xi8DRogqA
SCWOjjybOSEGlWsmu1gwXs0yNgqQijJR03JbMZoTcuDFctdFSk4XnnebfLiN20Ix
56fdVBMRotTFv6CCcvYZncyCp1POJQ6JtlwP3GDQufrgPy2uxZJGHUzPx9BUj4Bg
TDERPlDVjSZckc6uP6tIhzGm1PqklG34E770r3By66yeLEMaW1B6QX3IPrJ4oh7w
yhfty2UfsLQfiKyykqnt6+0SHM9IHg==
=cLnk
-END PGP SIGNATURE-






Re: [O] org-file-apps regex matching against path not link

2018-04-12 Thread Frankie Y. Liu
Hi Nicolas,

For:

\\.pdf:\\([0-9]+\\)\\'

[0-9]+ vs \d+ same issue, since the path not the link is being matched.

Example:
file:foo.pdf::1 will be matching on file:foo.pdf and the ::1 is dropped.

Therefore it doesn't matter what you put after :: it is not being used.





On Thu, Apr 12, 2018 at 12:38 PM, Nicolas Goaziou 
wrote:

> Hello,
>
> "Frankie Y. Liu"  writes:
>
> > I wanted to open a pdf at a particular page, the instructions under
> > org-file-apps suggested using
> >
> > (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . "evince -p %1
> > %s"))
>
> What is "\d+"? You may want to try [0-9]+ insteal.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] macro with inline source does not work in table cells

2018-04-12 Thread Severin Kempf
Hi

on [2018-04-12] at 02:40:13 PM -0400, Nicolas Goaziou  
wrote:

> The parser. Inline Babel code is not parsed in table cells. This could
> conflict with TBLFM lines.

I found where these restrictions are set in org-element.el; and the
comments state exactly what you said ("Ignore inline babel call and
inline src block as formulas are possible."). Can you think of an
example of this conflict?



Re: [O] org-file-apps regex matching against path not link

2018-04-12 Thread Nicolas Goaziou
Hello,

"Frankie Y. Liu"  writes:

> I wanted to open a pdf at a particular page, the instructions under
> org-file-apps suggested using
>
> (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . "evince -p %1
> %s"))

What is "\d+"? You may want to try [0-9]+ insteal.

Regards,

-- 
Nicolas Goaziou



[O] org-file-apps regex matching against path not link

2018-04-12 Thread Frankie Y. Liu
I wanted to open a pdf at a particular page, the instructions under
org-file-apps suggested using

(add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . "evince -p %1 %s"))

This doesn't work because the regular expression doesn't parse the link but
the path.  Therefore the ::(\d+) part is not being matched.

I had to write my own version using both file and link but maybe there is a
better way -- or a more elegant solution than what I have below.  Please
let me know.

(add-to-list 'org-file-apps
   '("\\.pdf\\'" .
 (lambda
   (file link)
   (let*
   ((mylink
 (split-string link "::"))
(option
 (>
  (length mylink)
  1))
(cmd
 (concat "evince " file
 (and option
  (concat " -p "
  (nth 1 mylink))
 (message "Running %s...done" cmd)
 (start-process-shell-command cmd nil cmd)


Re: [O] macro with inline source does not work in table cells

2018-04-12 Thread Nicolas Goaziou
Hello,

Severin Kempf  writes:

> This is very cumbersome for my particular document, which has a large
> number of cells that I am working with. I could add an additional column
> to facilitate this, but I don't see a good way to hide that column from
> the exporter -- I only want the result, not the data needed to generate
> the result.

You can pass header arguments to the `org-sbe' call. It may be possible
to get the results without the data.

>  What is preventing it from working in the table cell? What is
> allowing a simpler macro expansion to work inside of a table cell?

The parser. Inline Babel code is not parsed in table cells. This could
conflict with TBLFM lines.

Regards,

-- 
Nicolas Goaziou



Re: [O] macro with inline source does not work in table cells

2018-04-12 Thread Severin Kempf
Hi,

on [2018-04-11] at 06:52:42 AM -0400, Nicolas Goaziou  
wrote:

> inline source code is not supported in tables. You are expected to use 
> `org-sbe'.
>
> Regards,

Thanks for your suggestion. After some trial and error, I figured out
how to do this using babel:

<<< begin example org-mode file >>>
#+MACRO: kw src_emacs-lisp[:exports results :results raw]{(concat "=" (upcase 
"$1") "=")}
#+MACRO: ku =$1=

#+NAME: kwt
#+BEGIN_SRC emacs-lisp  :var kw="keyword"
(concat "=" (upcase kw) "=")
#+END_SRC

Try "hello {{{kw(world)}}}," but let's put it in a table [[tab:eg]]

#+NAME: tab:eg
#+CAPTION: Test table with "hello {{{kw(world)}}}"
| Statement | Object  |
|---+-|
| hello | {{{kw(world)}}} |
| this macro| {{{ku(works)}}} |
| this function | =KIND-OF-WORKS= |
#+TBLFM: @4$2='(org-sbe kwt (kw \"kind-of-works\"))
<<< end >>>

This is very cumbersome for my particular document, which has a large
number of cells that I am working with. I could add an additional column
to facilitate this, but I don't see a good way to hide that column from
the exporter -- I only want the result, not the data needed to generate
the result.

That being said, the documentation states that macro expansion takes
place, among other places, in table cells
(https://orgmode.org/manual/Macro-replacement.html#Macro-replacement).
When I look at ox.el, org-macro-replace-all is run prior to
org-babel-exp-process-buffer, and it looks to me like
org-babel-exp-process-buffer also includes inline blocks, obviously the
case because this process works in the document text and in the table
caption. What is preventing it from working in the table cell? What is
allowing a simpler macro expansion to work inside of a table cell?



[O] [PATCH] org-compat: Allow imenu items without hierarchy

2018-04-12 Thread Michael Hendricks
* lisp/org-compat.el (org-imenu-flat): New custom variable.
(org-imenu-get-tree): Skip hierarchical item structure if
org-imenu-flat is true.

Many of my Org files have deep hierarchies, but few total headings.
For those files, I find that navigating a flat menu structure is more
effective than navigating many nested menus.

A flat imenu structure also works well with packages, such as idomenu,
which navigate imenu items via search.
---
 lisp/org-compat.el | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index e7ea4153e..f24396ad8 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -600,6 +600,13 @@ This also applied for speedbar access."
   :group 'org-imenu-and-speedbar
   :type 'integer)
 
+(defcustom org-imenu-flat nil
+  "Non-nil creates all index items at the top level.  Nil creates
+a menu hierarchy that matches the buffer's hierarchy."
+  :group 'org-imenu-and-speedbar
+  :type 'boolean
+  :safe #'booleanp)
+
  Imenu
 
 (defvar-local org-imenu-markers nil
@@ -618,6 +625,7 @@ This also applied for speedbar access."
   (setq org-imenu-markers nil)
   (let* ((case-fold-search nil)
 (n org-imenu-depth)
+(flat org-imenu-flat)
 (re (concat "^" (org-get-limited-outline-regexp)))
 (subs (make-vector (1+ n) nil))
 (last-level 0)
@@ -632,10 +640,12 @@ This also applied for speedbar access."
 (setq head (org-link-display-format head0)
   m (org-imenu-new-marker))
 (org-add-props head nil 'org-imenu-marker m 'org-imenu t)
-(if (>= level last-level)
-(push (cons head m) (aref subs level))
-  (push (cons head (aref subs (1+ level))) (aref subs level))
-  (cl-loop for i from (1+ level) to n do (aset subs i nil)))
+(if flat
+(push (cons head m) (aref subs 1))
+  (if (>= level last-level)
+  (push (cons head m) (aref subs level))
+(push (cons head (aref subs (1+ level))) (aref subs level))
+(cl-loop for i from (1+ level) to n do (aset subs i nil
 (setq last-level level
 (aref subs 1)))
 
-- 
2.14.2



Re: [O] Bug: Weird interaction between ox-extra and include :minlevel

2018-04-12 Thread Daniel P Gomez
I was thinking of #+ignore_tags. as an analog of #+exclude_tags. While
#+exclude_tags removes a complete subtree from export, #+ignore_tags
would only ignore headlines and insert the contents.
When used in combination, subtree would be excluded no matter what.

#+IGNORE_TAGS: ignore bar
#+EXLUDE_TAGS: noexport foo

The idea of ignore_tags, for me, would to allow grouping content
within the Org file in a manner that differs from the grouping of
content upon export - without having to resort to filter-hooks. Not
that hooks are bad, but they are harder to construct without proper
elisp skills and require knowledge about the Org API. Furthermore,
tags are excellent because they're easy to manipulate and search for.

On Thu, Apr 12, 2018 at 3:28 PM, Nicolas Goaziou  wrote:
> Hello,
>
> "Daniel P. Gomez"  writes:
>
>> Is there any intention of bringing ox-extra functionality into main
>> Org? Something like #+ignore_tags would be a powerful addition for
>> fine grained export control, in my opinion.
>
> IIRC, "ox-extra" was written because we could not agree on a definition
> and an implementation of the ignore headline feature.
>
> I don't know what you do mean by "something like #+ignore_tags", but you
> could discuss it on this ML.
>
> Regards,
>
> --
> Nicolas Goaziou



Re: [O] BUG : cannot export src block to html

2018-04-12 Thread Giuseppe Lipari
Thanks, indeed. I will contact the maintainer.

Giuseppe Lipari


Le jeu. 12 avr. 2018 à 15:40, Nicolas Goaziou  a
écrit :

> Hello,
>
> Giuseppe Lipari  writes:
>
> > Dear all,
> >
> > (I am reposting it here with a more appropriate subject-line, hoping to
> get
> > more attention)
> >
> > Consider the following org file:
> >
> > * An example of org file
> >
> >   Here I put a C snippet
> >
> >   #+BEGIN_SRC c
> >   int main() {
> >   printf("hello world\n");
> >   return 0;
> >   }
> >   #+END_SRC
>
> I cannot reproduce the error.
>
> > Debugger entered--Lisp error: (void-variable overlays)
> >   htmlize-sorted-overlays-at(1)
> >   htmlize-faces-at-point()
> >   htmlize-buffer-1()
> >   htmlize-region(1 58)
>
> It seems related to htmlize package, not to Org mode. You may want to
> report it upstream.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] Bug: Editing cookie in table column breaks tabbing [9.1.9 (9.1.9-3-gb1a639-elpa @ /home/foo/.emacs.d/elpa/org-20180402/)]

2018-04-12 Thread Nicolas Goaziou
Hello,

Sebastian P. Luque  writes:

> ╭─ [ emacs_init.el ]
> │ (package-initialize)
> │ (toggle-debug-on-error)
> │ (setq org-startup-align-all-tables t)
> ╰─
>
> First line is to ensure the Elpa Org package is available.
>
> ╭─ [ bug.org ]
> │ * Column width alignment
> │ 
> │ |   A |B | C |
> │ | |  | <5>   |
> │ | 123 | 1234 | 56789 |
> ╰─
>
> and then do:
>
> emacs -q -l emacs_init.el bug.org
>
> Now edit the column width cookie a few times, hitting TAB after each
> edit.  I haven't yet found what sequence of edits that triggers the
> error in this example, as it seems inconsistent.  I tried switching
> between different permutations of 2, 3, 4, 5, and eventually the
> debugger is entered.  During normal use cases, I get into the error
> right away.

I still cannot reproduce it. Could you update Org (e.g., from GNU ELPA)
and try again?

Regards,

-- 
Nicolas Goaziou



Re: [O] BUG : cannot export src block to html

2018-04-12 Thread Nicolas Goaziou
Hello,

Giuseppe Lipari  writes:

> Dear all,
>
> (I am reposting it here with a more appropriate subject-line, hoping to get
> more attention)
>
> Consider the following org file:
>
> * An example of org file
>
>   Here I put a C snippet
>
>   #+BEGIN_SRC c
>   int main() {
>   printf("hello world\n");
>   return 0;
>   }
>   #+END_SRC

I cannot reproduce the error.

> Debugger entered--Lisp error: (void-variable overlays)
>   htmlize-sorted-overlays-at(1)
>   htmlize-faces-at-point()
>   htmlize-buffer-1()
>   htmlize-region(1 58)

It seems related to htmlize package, not to Org mode. You may want to
report it upstream.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Weird interaction between ox-extra and include :minlevel

2018-04-12 Thread Nicolas Goaziou
Hello,

"Daniel P. Gomez"  writes:

> Is there any intention of bringing ox-extra functionality into main
> Org? Something like #+ignore_tags would be a powerful addition for
> fine grained export control, in my opinion.

IIRC, "ox-extra" was written because we could not agree on a definition
and an implementation of the ignore headline feature. 

I don't know what you do mean by "something like #+ignore_tags", but you
could discuss it on this ML.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] org-capture: Add a custom to control save target file or not.

2018-04-12 Thread Nicolas Goaziou
Hello,

tumashu  writes:

> I use org-capture to capture text to a file of my mobile phone
> with the help of tramp and termux's sshd, the save buffer is very
> slow, so I want to org-capture-finalize just update buffer, and
> I save buffer manually when need.

Thank you. Comments follow.

> By the way, can we contribute org-mode with the help of PR feature in
> code.orgmode.org?

AFAIC, I'd rather deal with email than with a web interface. However,
Bastien accepted PR from code.orgmode.org in the past.

The problem with PR in code.orgmode.org is that the discussion around
the patch happens somewhere else than on the ML.

> +(defcustom org-capture-finalize-save-buffer t
> +  "When nil, org-capture-finalize will not save target file's buffer."
> +  :group 'org-capture
> +  :version "24.1"
> +  :type 'boolean)

The :version value is incorrect. Also, it is missing ":safe #'booleanp".

>  (defcustom org-capture-bookmark t
>"When non-nil, add a bookmark pointing at the last stored
>  position when capturing."
> @@ -791,7 +797,10 @@ captured item after finalizing."
>   (org-encrypt-entry)))
>  
>  ;; Kill the indirect buffer
> -(save-buffer)
> +(if org-capture-finalize-save-buffer
> + (save-buffer)
> +  (message "The capture target file is not auto saved, please save it 
> manually."))

Would it make sense to simply not call `save-buffer' in all cases?
Saving buffer after a capture is rather opinionated.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] add "link" :results type for Babel

2018-04-12 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> I attached new generated patches.

Applied, with a few changes.

Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Bug: Weird interaction between ox-extra and include :minlevel

2018-04-12 Thread Daniel P. Gomez

Hi all,


TLDR: Using ox-extras :IGNORE: tags break #+INCLUDE :minlevel. 
Ideally ox-extras functionality could make it into ox.



I'm using Org Mode to structure my thesis, and one of the Org 
features that I rely on the most are the #+INCLUDE derivatives.


My setup is such that I have a main thesis.org file with the 
(simplified) following contents:


--
#+latexclass: thesis
#+setupfile: thesis.setup
#+exclude_tags: manuscript noexport

* Chapter 1
#+INCLUDE: chap1/chapter1.org :lines "3-"

etc..
--

And I have chapter files where, e.g., the Methods section is 
formatted differently whether it is included in the main body of 
the thesis or in a manuscript:

--
#+latexclass: manuscript
#+setupfile: manuscript.setup
#+exclude_tags: thesis noexport

etc..

# For thesis, include methods directly
* Methods :thesis:
#+INCLUDE: methods.org :lines "3-"


# For paper, wrap methods into a specific control sequence and 
 adjust headline levels.

* Methods :ignore:manuscript:

#+LATEX: \matmethods{
#+INCLUDE: methods.org :lines "3-" :minlevel 2
#+LATEX: }


* Insert Methods :ignore:manuscript:
#+LATEX: \showmatmethods{}
--

I don't know if this is the cleanest setup, but it works well for 
me because I get to reuse my files.
The one issue I have with this setup, is that besides relying on 
IGNORE tags, I also rely on :minlevel to adjust the headlines. 
However, because ox-extra promotes all subtrees, it breaks 
minlevel's functionality.


Would anyone have an idea on how to fix this? Is there any 
intention of bringing ox-extra functionality into main Org? 
Something like #+ignore_tags would be a powerful addition for fine 
grained export control, in my opinion.



Thank you

--
Daniel P. Gomez



Re: [O] org-move-subtree-down whitespace dance

2018-04-12 Thread Marco Wahl
Hi,

Thanks for your time!

>> After having stumbled over
>>
>> 
>> https://emacs.stackexchange.com/questions/32144/org-mode-org-move-subtree-down-function-strange-behavior
>>
>> I also think the behavior of org-move-subtree-down is strange.
>>
>> What about pulling out the dance with the whitespace from
>> org-move-subtree-down and just move the subtree as it is?
>
> There's at least a minor issue. I you like to separate your heading with
> N spaces, you must keep N blank lines at the end of the buffer at all
> time. Granted, the current implementation requires the same thing before
> the first headline, but those are easier to see and maintain.

Agreed.  This is a point.

Possibly one could write some kind of formatter to maintain a certain
scheme to separate subtrees with N blank lines.

> Intuitively, I would say the current behaviour is better, but feel free
> to provide a patch so we can test the other way.

I still propose to let org-move-subtree-down simply just move the
subtree as it is.  Concretely see the patch.


Thanks for giving it a chance and best regards
  Marco

>From f5f9f9748a8e9b57282bdc60bc14efd0e8e8bea1 Mon Sep 17 00:00:00 2001
From: Marco Wahl 
Date: Wed, 11 Apr 2018 14:55:00 +0200
Subject: [PATCH] org: Remove special whitespace treatment when moving subtree

* lisp/org.el (org-move-subtree-down): Remove special whitespace treatment.
* testing/lisp/test-org.el (test-org/drag-element-backward):
  Accommodate test.
---
 lisp/org.el  | 29 -
 testing/lisp/test-org.el |  2 +-
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 075c8f32f..d16d73cd4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8128,32 +8128,22 @@ case."
 	 (ins-point (make-marker))
 	 (cnt (abs arg))
 	 (col (current-column))
-	 beg beg0 end txt folded ne-beg ne-end ne-ins ins-end)
+	 beg end txt folded)
  ;; Select the tree
  (org-back-to-heading)
- (setq beg0 (point))
- (save-excursion
-   (setq ne-beg (org-back-over-empty-lines))
-   (setq beg (point)))
+ (setq beg (point))
  (save-match-data
(save-excursion (outline-end-of-heading)
 		   (setq folded (org-invisible-p)))
(progn (org-end-of-subtree nil t)
 	  (unless (eobp) (backward-char
  (outline-next-heading)
- (setq ne-end (org-back-over-empty-lines))
  (setq end (point))
- (goto-char beg0)
- (when (and (> arg 0) (org-first-sibling-p) (< ne-end ne-beg))
-   ;; include less whitespace
-   (save-excursion
-	 (goto-char beg)
-	 (forward-line (- ne-beg ne-end))
-	 (setq beg (point
+ (goto-char beg)
  ;; Find insertion point, with error handling
  (while (> cnt 0)
(unless (and (funcall movfunc) (looking-at org-outline-regexp))
-	 (goto-char beg0)
+	 (goto-char beg)
 	 (user-error "Cannot move past superior level or buffer limit"))
(setq cnt (1- cnt)))
  (when (> arg 0)
@@ -8162,7 +8152,6 @@ case."
(save-excursion
 	 (org-back-over-empty-lines)
 	 (or (bolp) (newline
- (setq ne-ins (org-back-over-empty-lines))
  (move-marker ins-point (point))
  (setq txt (buffer-substring beg end))
  (org-save-markers-in-region beg end)
@@ -8176,18 +8165,8 @@ case."
(org-reinstall-markers-in-region bbb)
(move-marker ins-point bbb))
  (or (bolp) (insert "\n"))
- (setq ins-end (point))
  (goto-char ins-point)
  (org-skip-whitespace)
- (when (and (< arg 0)
-		(org-first-sibling-p)
-		(> ne-ins ne-beg))
-   ;; Move whitespace back to beginning
-   (save-excursion
-	 (goto-char ins-end)
-	 (let ((kill-whole-line t))
-	   (kill-line (- ne-ins ne-beg)) (point)))
-   (insert (make-string (- ne-ins ne-beg) ?\n)))
  (move-marker ins-point nil)
  (if folded
 	 (outline-hide-subtree)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index fe2111392..2438508bf 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -3965,7 +3965,7 @@ Text.
   ;; Pathological case: handle call with point in blank lines right
   ;; after a headline.
   (should
-   (equal "* H2\n* H1\nText\n\n"
+   (equal "* H2\n\n* H1\nText\n"
 	  (org-test-with-temp-text "* H1\nText\n* H2\n\n"
 	(org-drag-element-backward)
 	(buffer-string)
-- 
2.17.0