Re: [O] Display-level automatic subtree numbering

2018-11-01 Thread Eric S Fraga
On Thursday,  1 Nov 2018 at 18:49, Nicolas Goaziou wrote:
> As I was offline for a few days, I toyed a bit with this. I wrote the
> following library. I didn't test it thoroughly. I didn't write
> regression tests either.

Although I probably won't use this often, I have tried it out and it
seems to work very well.  I've only tried a couple of articles where
numbering makes some sense.  Looks good too.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4



Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-11-01 Thread stardiviner


Nicolas Goaziou  writes:

>> ---
>>  lisp/org-src.el | 9 -
>>  lisp/org.el | 9 ++---
>>  2 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/lisp/org-src.el b/lisp/org-src.el
>> index 42e1225ed..0426ff96a 100644
>> --- a/lisp/org-src.el
>> +++ b/lisp/org-src.el
>
> Why not using `defvar-local' instead? Also, since it is meant to be used
> in other libraries, it should be `org-src-source-file'.

Because the variable `org-src-source-file' is a bridge to pass info between two 
buffers "source buffer" and source block opened "dedicated buffer". So this 
variable must be global. Otherwise the "dedicated buffer" can't read it.

>
>> +   (lang-f (progn
>> + (setq-local org-src--source-file (buffer-file-name))
>> + (and (eq type 'src-block) (org-src--get-lang-mode lang
>
> I don't think this is the right place to set `org-src--source-file': it
> is unrelated to LANG-F.
>

I tried this:

#+begin_src diff
@@ -1000,9 +1000,11 @@ name of the sub-editing buffer."
 (let* ((lang
(if (eq type 'src-block) (org-element-property :language element)
  "example"))
-  (lang-f (progn
-(setq-local org-src--source-file (buffer-file-name))
-(and (eq type 'src-block) (org-src--get-lang-mode lang
+  (lang-f (and (eq type 'src-block) (org-src--get-lang-mode lang)))
+  (org-src-source-file (buffer-file-name))
+  (initialize (lambda ()
+(setq org-src-source-file (buffer-file-name))
+(funcall lang-f)))
   (babel-info (and (eq type 'src-block)
(org-babel-get-src-block-info 'light)))
   deactivate-mark)
#+end_src

Put it into initialize function. This is the best way I can come up with.

> Also, the value comes from the source buffer, but the variable needs to
> be set in the edit buffer. AFAIU, here you set it in the source buffer,
> not in the edit buffer.
>
>> +   (insert (format coderef-format label))
>> +   (setq link (format "file:%s::%s"
>> +  org-src--source-file
>> +  (concat "(" label ")")))
>
> Should we check if `org-src-source-file' is the same as the current
> file, and offer a simplified link in this case?

Don't know which part you mean, I just insert the source file path into the 
link. About the final link is modified by bellowing `org-link-file-path-type' 
variable.

>
>> (setq desc nil)))
>>  (t (setq link nil)
>>  
>> @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for 
>> type-specific completion support
>>  (setq path (expand-file-name path)))
>> ((eq org-link-file-path-type 'relative)
>>  (setq path (file-relative-name path)))
>> +   ((eq org-link-file-path-type 'adaptive)
>> +(setq path (file-relative-name path)))
>> (t
>>  (save-match-data
>>(if (string-match (concat "^" (regexp-quote
>
> Would you writing a few tests?
>
> Thank you.
>
> Regards,


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] How to generate CLOCKSUM property from time ranges?

2018-11-01 Thread Leo Alekseyev
Greetings all,
I am looking into using `org-invoice` to generate some invoices. It uses
the CLOCKSUM property, which according to the docs gets auto-generated when
the clock entries are summed in a subtree.

Concretely, docs say: "CLOCKSUM: The sum of CLOCK intervals in the
subtree.  ‘org-clock-sum’ must be run first to compute the values in the
current buffer."  However, `org-clock-sum` is a non-interactive function,
and evaluating it by hand doesn't do anything for me.

Org-clock-report is able to generate the table with total subtree sums, but
doesn't set the CLOCKSUM property.

Question: how do I get CLOCKSUM property generated and stored in a subtree
with timestamps so that org-invoice functions can pick it up?
--Leo


Re: [O] getting close on latex letterheads [was: letterhead and signature in odt export]

2018-11-01 Thread Matt Price
On Thu, Nov 1, 2018 at 9:58 AM Eric S Fraga  wrote:

> Cannot help you on this but I did enjoy reading the references for the
> students! :-)
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4
>

Having @ckelty on the CC: list inspires me no end.


Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Nicolas Goaziou
Philip Hudson  writes:

> Here's a minimal failing capture-completed template:
>
> --- Cut here --
>
> #+FOO: bar
>
> * Baz
> -- Cut here --

I would like to see you capture template in its elisp form, i.e., as set
in `org-capture-templates'.

Thank you.



Re: [O] org-store/insert-link truncating the full subject of mails

2018-11-01 Thread Nicolas Goaziou
Hello,

"Garreau, Alexandre"  writes:

> This is an argument in favor of immobility.

True. Immobility is sometimes good, too.

> Yes, if only each user of each piece of software took the time to read
> the integrality of documentation each time they used something: I don’t
> and only did partially for org, yet… but for instance I did for Gnus, a
> long time ago, and never did it again: as example, did you?.

I don't see the point of reading the whole manual when you are looking
for some specific information. You can use, e.g., indices for that.

> Default are an important thing, they should fit what the most common,
> unspecific, and ignorant about the software in question, person.
> Documentation should be there only to adapt to more specific, and less
> common, cases (and, when possible, software should be made so that to
> conditionally do the right thing depending of the context so that
> changing the default behavior is less and less needed).  Not the other
> way around.

These are good rules of thumb when you are defining a default value.
When the default value was set ages ago, and some users may have grown
habits on it, you have to strike a balance between usage and theory. To
put it differently, changing default values annoys some users, and
a better default value may not be worth it.

It seems that no one is firmly attached to the current default value, so
I removed the truncation in "next" branch, i.e., Org 9.3.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Philip Hudson
On Thu, 1 Nov 2018 at 22:12, Nicolas Goaziou  wrote:
>
> Philip Hudson  writes:
>
> Could you show your template? Could you explain how you initiate the
> capture process (e.g., with arguments)? Also, could you show the desired
> output?

Here's a minimal failing capture-completed template:

--- Cut here --
#+FOO: bar

* Baz
-- Cut here --

Pass this into `org-capture-verify-tree'. This will reproduce the error.

My fix strips out the leading in-buffer settings for the duration of
that call only. Effectively what gets passed into
`org-capture-verify-tree' is then this:

--- Cut here --
* Baz
--- Cut here --

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



[O] need function to extract time from timestamp in the description of the first link in an entry

2018-11-01 Thread Samuel Wales
timestamps in link descriptions use {} instead of [].  are there
functions to get the time from those?

org-entry-get on "TIMESTAMP_IA" will get the time from this:

  * CONVERSATION [2018-11-01 Thu 11:09] cleaned using generic cetaphil

analogously, if the keyword is CONVLINK, i want to get the time from this:

  * CONVLINK [[id:8d3b3ad4-784a-4049-ba42-8409b24e4e7e][{2018-11-01
Thu 11:09} cleaned uvex with generic cetaphil]]

but there is no org-entry-get property for "TIMESTAMP_LINK".

suggestions?


p.s.

i have always used org-entry-get in this old code to sort in both
agenda and outline.  i don't know if this is good code or not.  but it
works wonderfully to abstract over outline and agenda.

(defun alpha-org-entry-get (property &optional sg inherit)
  "Return the value of PROPERTY, whether you are in the outline
or the agenda, by calling `org-entry-get'.

SG \(string given\) is the agenda header string to use \(provided
by user-defined agenda sorting\) or nil.  If it is nil and you
are in the outline, use the current headline directly.  If it is
nil and you are in the agenda, use the current headline by going
to the outline.

INHERIT is the inherit argument for `org-entry-get'.

There are a few questions about Org properties:

  1) What does it mean to get alltags without inheritance or tags
 with inheritance?  I guess org-entry-get was originally
 meant for properties, not tags, so you don't use inherit?
  2) How do you get the first timestamp in an entry?  There seems
 to be no way without specifying the type of timestamp.

According to the manual at the time of this writing, possible
properties include these.

 TODO The TODO keyword of the entry.
 TAGS The tags defined directly in the headline.
 ALLTAGS  All tags, including inherited ones.
 CATEGORY The category of an entry.
 PRIORITY The priority of the entry, a string with a single letter.
 DEADLINE The deadline time string, without the angular brackets.
 SCHEDULEDThe scheduling timestamp, without the angular brackets.
 CLOSED   When was this entry closed?
 TIMESTAMPThe first keyword-less timestamp in the entry.
   - this works even in the headline
 TIMESTAMP_IA The first inactive timestamp in the entry.
   - this works even in the headline
   - it does not seem to report CLOSED ts -- use CLOSED
 CLOCKSUM The sum of CLOCK intervals in the subtree.  org-clock-sum
  must be run first to compute the values.
 ITEM The content of the entry.

For anything else, you can use marker-buffer in the code below to
get to the outline and do manual parsing or use some other
function.

The idea is to use this as a single way to get most metadata no
matter where you are.
"

  (org-entry-get
   (ecase major-mode
 ((org-agenda-mode)
;;;
;;; will this work faster?  or is this for something other than
;;; agenda?
;;;
;;; my guess is it is just for doing things not getting things
;;;
;;; (org-with-point-at (org-get-at-bol 'org-hd-marker)
;;; ;; do here what you need to do at the location of the entry
;;; )

  ;; sg is provided by programmatic agenda use in sorting.
  ;;
  ;; should also be provided in sorting filter.
  ;;
  ;; thus presumably the buffer substring only gets called
  ;; for outline.  otherwise we could maybe do
  ;; (get-text-property (point-at-bol) 'org-marker)
  ;;
  ;; fixme check if sg is provided.  however, if we use
  ;; org-agenda-before-sorting-filter-function, it is
  ;; provided i guess.
  (let* ((s (or sg
(buffer-substring (point-at-bol)
  (point-at-eol
 ;; get marker from sg or string
 ;;
 ;; what is the difference between these? supposedly
 ;; hd-marker is not always there.

 ;; fixme 0 is a total guess.  i had had 1.
 (m (or (get-text-property 0 'org-marker s)
(get-text-property 0 'org-hd-marker s
;;do this to get to the org outline buffer from the
;;agenda buffer if you need other data that org-entry-get
;;cannot extract
;;
;;(b (and m (marker-buffer m
;;;(if b
;;;(with-current-buffer b
;;;  (goto-char m)
m))
 ((org-mode) (point)))
   property
   inherit))



Re: [O] Bug: Bad string comparison in org-all-archive-files (org 9.1.14)

2018-11-01 Thread Nicolas Goaziou
Hello,

Nils Gustafsson  writes:

> I stubled upon this while trying to work out why my clocktables
> weren't behaving as expected. In one of my org files I have several
> large trees set up to use different archive files via :ARCHIVE:
> properties, and the clocktable I added with :scope file-with-archives
> seemed to be ignoring those archives.
>
> Except it worked fine when I used a default archive for the whole
> file, or added a custom one using #+ARCHIVE: instead. After some
> experimenting and digging around in the source code I've found that
> the actual problem is a bad string comparison in a function called
> org-all-archive-files in org-archive.el.
>
>
> The issue:
>
> The real problem turns out to be that org-all-archive-files does not
> do what it says on the can. It should list all archive files for the
> current buffer, but will fail to pick up archive files listed in
> :ARCHIVE: properties.
>
> To reproduce, make a new org file called temp.org (or your choice of
> name) containing something like:
>
> * Test-heading
>   :PROPERTIES:
>   :ARCHIVE: test_archive::
>   :END:
>
>
> Then create an empty file called test_archive in the same directory,
> and try calling (message "archives: %s" (org-all-archive-files)) in
> that buffer.
>
>
> Expected output: "archives: (/some/path/test_archive)"
>
> Actual output: "archives: nil"
>
>
> The cause:
>
> Specifically the error is in this part of org-all-archive-files
> starting on line 170 of org-archive.el (original indentation not
> preserved):
>
>
> (when (save-match-data
>   (if (eq (match-string 1) ":") (org-at-property-p)
> (eq (org-element-type (org-element-at-point)) 'keyword))) ...
>
>
> That (eq (match-string 1) ":") always fails. Replacing eq with string=
> in that expression seems to restore the expected behaviour:
> org-all-archive-files no longer ignores archive files listed in
> :ARCHIVE: properties. And indeed, it resolves the clocktable issue I
> was having as well.

Indeed. I applied your fix.

Thank you for the analysis!

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> I expected my (previously working) org-capture template to be
> inserted into a newly-created empty Org file. The file name and
> location are the output of a function specified in the template
> (sequentially numbered filename).

Could you show your template? Could you explain how you initiate the
capture process (e.g., with arguments)? Also, could you show the desired
output?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Full-width characters break column display

2018-11-01 Thread Nicolas Goaziou
Leo Gaspard  writes:

> Nicolas Goaziou  writes:
>>> Small issue I've been having with org-mode: full-width characters
>>> (eg. 何か) appear to be breaking column display.
>>
>> Org tables assume a fixed-width font.  You need to use one, if such
>> thing exists for these characters.
>
> Well, it is fixed-width, but twice the width of spaces and vertical
> characters.
>
> Using it with regular English makes it look like th
> is, which I guess you'll grant me is not really usable :)
>
> I wonder if it'd be possible to support full-width chars for CJK
> script?

The problem is that 

  (string-width "何か")

equals

  (string-width "")

i.e, 4 characters, but both strings do not have the same length
visually.

As long as the two sexps above disagree, it seems difficult to support
this.



Re: [O] Bug: symbol function's definition is null : signum [7.5]

2018-11-01 Thread Nicolas Goaziou
Hello,

Jared Windover  writes:

> I was still seeing this error. Switching signum to cl-signum in org.el
> fixed it.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] letterhead and signature in odt export

2018-11-01 Thread Tim Cross


Matt Price  writes:

> On Tue, Oct 30, 2018 at 5:41 PM Tim Cross  wrote:
>
>>
>> I've never delved into the XML nightmare that is ODT and stick with
>> latex/PDF export.
>>
>> Here is how I handled needing to have a logo and banner at the top of my
>> documents. Essentially, it involves using the Latex 'minipage'
>> environment to setup the layout and the xcolor package to handle
>> colours. Getting it working is somewhat trial and error, but once you
>> have it, it is pretty much set and forget.
>>
>> The below is an early version. I later refined it and put it into my
>> org-latex-classes variable, but removed it when I left the University
>> for a new employer. It should be fairly straight-forward to adapt to a
>> letter head. The only challenge will be if your Uni Marketing/PR are
>> very rigid re: format. In particular, fonts can be a challenge if they
>> have selected something unusual.
>>
>
> whew, OK, this is interesting. I guess you have written your own class
> somewhere, is that right? And even though your header is defined in
> latex_header it still somehow is included inside of \begin{document}?
>

Essentially, yes. I defined a new org-latex-class where all the
LATEX_HEADER_EXTRA lines below were put into the [EXTRA] section of the
org-latex-class definition. I then only needed to add the LATEX_CLASS
header line in my document and all would work. Note that there is an
order to how the elements in org-latex-class are processed and you do
have to get that correct - for example,  the LATEX_HEADER line needs to
go into the [PACKAGES] section and the rest in the [EXTRA] section to
ensure things are put in the right order. 

It will likely take some trial and error to get things correct and it
can be a little fragile i.e. if you had a long title/heading/author etc,
things may not wrap/align correctly. I'm sure someone with even more
Latex experience could do a better definition, but I found it worked
really well for me.

My suggestion would be to use a org template/skeleton file initially so
that it is easier to tweak and then once you have it nailed down, look
at defining a new org-latex-class entry.

I do recall it took me a few goes to really understand the
org-latex-class definition - but that could just be me being a bit slow!

> ... and if I turn this into an org latex class, then am I right that I an
> simply set that latex_class header at the top of a document and all of this
> will be handled for me autmagically on export? That would be fantastic.
>


> Gonna follow up some more in response to ckelty, whose stuff I've been
> working with thus far.
>
>>
>> #+TITLE: X
>> #+AUTHOR: XXX
>> #+DATE: \today
>> #+SUBTITLE: IAM Use Case
>> #+OPTIONS: ^:nil num:nil toc:nil tags:nil |:t
>> #+LATEX_CLASS: une-article
>> #+LATEX-OPTIONS: 12pt,a4paper
>> #+LATEX_HEADER: \usepackage{xcolor}
>> #+LATEX_HEADER_EXTRA: \definecolor{unegreen}{HTML}{7AB800}
>> #+LATEX_HEADER_EXTRA: \definecolor{Black}{HTML}{00}
>> #+LATEX_HEADER_EXTRA: \definecolor{White}{HTML}{FF}
>> #+LATEX_HEADER_EXTRA: \definecolor{dimgrey}{HTML}{696969}
>> #+LATEX_HEADER_EXTRA: \makeatletter
>> #+LATEX_HEADER_EXTRA: \def\@maketitle{
>> #+LATEX_HEADER_EXTRA:  \noindent \begin{minipage}[c][4cm][t]{\linewidth}
>> #+LATEX_HEADER_EXTRA:\colorbox{Black}{%
>> #+LATEX_HEADER_EXTRA:  \begin{minipage}[t][4cm][c]{4cm}
>> #+LATEX_HEADER_EXTRA:  \flushleft
>> #+LATEX_HEADER_EXTRA:  \includegraphics{~/Pictures/unelogo_medium.png}
>> #+LATEX_HEADER_EXTRA:\end{minipage}}
>> #+LATEX_HEADER_EXTRA:\colorbox{unegreen}{%
>> #+LATEX_HEADER_EXTRA:  \begin{minipage}[t][4cm][c]{10cm}
>> #+LATEX_HEADER_EXTRA:\flushright
>> #+LATEX_HEADER_EXTRA:\Large \textbf{\color{White}{\@title}} \\
>> #+LATEX_HEADER_EXTRA: \vspace{4pt}
>> #+LATEX_HEADER_EXTRA:\small \color{White}{\@author} \\
>> #+LATEX_HEADER_EXTRA:\small \color{White}{\@date}
>> #+LATEX_HEADER_EXTRA:  \end{minipage}}
>> #+LATEX_HEADER_EXTRA:\end{minipage}}
>> #+LATEX_HEADER_EXTRA: \makeatother
>>
>>
>>
>> Jeff Filipovits  writes:
>>
>> > Would you mind sharing them? This is a problem I am trying to figure out
>> as
>> > well.
>> >
>> > On Tue, Oct 30, 2018, 9:29 AM Eric S Fraga  wrote:
>> >
>> >> Matt,
>> >>
>> >> I've replied directly to you with some files.
>> >> --
>> >> Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4
>> >>
>> >>
>>
>>
>> --
>> Tim Cross
>>


-- 
Tim Cross



Re: [O] Help with sharing emacs-org presentation

2018-11-01 Thread Joseph Vidal-Rosset
Hello,

This LaTex code to put before \begin{document} : 

\AtBeginSection[]{\begin{frame}\frametitle{}\tableofcontents[currentsection,hideothersubsections]\end{frame}}

is very  useful, because it recalls  the steps of your  presentation and
focuses on the current section.

I hope that helps.

Best wishes, 

-- 
Jo



Re: [O] Full-width characters break column display

2018-11-01 Thread Leo Gaspard
Nicolas Goaziou  writes:
>> Small issue I've been having with org-mode: full-width characters
>> (eg. 何か) appear to be breaking column display.
>
> Org tables assume a fixed-width font.  You need to use one, if such
> thing exists for these characters.

Well, it is fixed-width, but twice the width of spaces and vertical
characters.

Using it with regular English makes it look like th
is, which I guess you'll grant me is not really usable :)

I wonder if it'd be possible to support full-width chars for CJK script?



Re: [O] Bug: symbol function's definition is null : signum [7.5]

2018-11-01 Thread Jared Windover
I was still seeing this error. Switching signum to cl-signum in org.el
fixed it.

-Jared


Re: [O] [PATCH] clocktable thinks Oct 29 is Oct 28 [9.1.14 (release_9.1.14-1012-g643481 @ /home/unhammer/src/org-mode/lisp/)]

2018-11-01 Thread Nicolas Goaziou
Hello,

Kevin Brubeck Unhammer  writes:

> The attached patch solves this, as far as I can tell.

I rewrote `org-clocktable-steps' in "next" branch, and the bug doesn't
seem to appear there. Therefore, I applied your patch in master, but
dropped it in next, except for the test.

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] bibtex setup .dir-locals.el

2018-11-01 Thread edgar

On 2018-10-31 15:27, John Kitchin wrote:

You do have to close the org-file, and then reopen it after you make
that file, and when I do that I am prompted whether to apply or ignore
the settings.


Oh! may be I need to re-open the file. I tried with reloading dir-local 
variables and reverting the buffer.



It might be simpler to just use a bibliography link in the file though:

bibliography:References.bib


Yes, I used to have \addbibresource{References.bib}, but I wanted to 
have the whole configuration on the .dir-locals.el file. I guess that 
bibliography:References.bib is more general.


Thank you very much, Dr. Kitchin!

-

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Re: [O] bibtex setup .dir-locals.el

2018-11-01 Thread John Kitchin
the bibliography link is just for bibtex. If you are using biblatex/biber I
think you would put that in a latex header, e.g.

#+latex_header: \addbibresource{References.bib}

Both of these are file-local though, and won't affect other files in that
directory.

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, Nov 1, 2018 at 1:43 PM  wrote:

> On 2018-10-31 15:27, John Kitchin wrote:
> > You do have to close the org-file, and then reopen it after you make
> > that file, and when I do that I am prompted whether to apply or ignore
> > the settings.
>
> Oh! may be I need to re-open the file. I tried with reloading dir-local
> variables and reverting the buffer.
>
> > It might be simpler to just use a bibliography link in the file though:
> >
> > bibliography:References.bib
>
> Yes, I used to have \addbibresource{References.bib}, but I wanted to
> have the whole configuration on the .dir-locals.el file. I guess that
> bibliography:References.bib is more general.
>
> Thank you very much, Dr. Kitchin!
>
> -
>
> ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of
> the NSA's hands!
> $24.95 ONETIME Lifetime accounts with Privacy Features!
> 15GB disk! No bandwidth quotas!
> Commercial and Bulk Mail Options!
>


Re: [O] Display-level automatic subtree numbering

2018-11-01 Thread Nicolas Goaziou
Hello,

"Garreau, Alexandre"  writes:

> No it doesn’t update anything, and doesn’t color number compatibly with
> outlining.  Also it’s not integrated in org and only available in melpa,
> unsigned.

As I was offline for a few days, I toyed a bit with this. I wrote the
following library. I didn't test it thoroughly. I didn't write
regression tests either.

Also, it ignores UNNUMBERED property and export tags. I have the feeling
these are orthogonal requirements (i.e., if you want to see the
numbering obtained upon export, just export your document).

You may want to test it. It could go in GNU ELPA or some such if fast
and accurate enough.

Regards,

-- 
Nicolas Goaziou


org-num.el
Description: Dynamic headline numbering in Org


Re: [O] coderef does not provide file path for org-insert-link when not in original buffre

2018-11-01 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> I regenerated the patch.

Thank you. Some more comments.

> * org-src.el (org-src-source-file): Add a variable to get the file path
>at the beginning of the function `org-src--edit-element'.
> * org.el (org-insert-link): support option org-link-file-path-type
>   'adaptive value.
> ---
>  lisp/org-src.el | 9 -
>  lisp/org.el | 9 ++---
>  2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/lisp/org-src.el b/lisp/org-src.el
> index 42e1225ed..0426ff96a 100644
> --- a/lisp/org-src.el
> +++ b/lisp/org-src.el
> @@ -277,6 +277,11 @@ issued in the language major mode buffer."
>"Type of element being edited, as a symbol.")
>  (put 'org-src--source-type 'permanent-local t)
>  
> +(defvar org-src--source-file nil
> +  "A variable used to store the source file path before entering
> +  source block dedicated buffer.")
> +(put 'org-src--source-file 'permanent-local t)

The first sentence of a docstring needs to be one or more complete
sentences.

Why not using `defvar-local' instead? Also, since it is meant to be used
in other libraries, it should be `org-src-source-file'.

> +(lang-f (progn
> +  (setq-local org-src--source-file (buffer-file-name))
> +  (and (eq type 'src-block) (org-src--get-lang-mode lang

I don't think this is the right place to set `org-src--source-file': it
is unrelated to LANG-F.

Also, the value comes from the source buffer, but the variable needs to
be set in the edit buffer. AFAIU, here you set it in the source buffer,
not in the edit buffer.

> +(insert (format coderef-format label))
> +(setq link (format "file:%s::%s"
> +   org-src--source-file
> +   (concat "(" label ")")))

Should we check if `org-src-source-file' is the same as the current
file, and offer a simplified link in this case?

>  (setq desc nil)))
>   (t (setq link nil)
>  
> @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for 
> type-specific completion support
>   (setq path (expand-file-name path)))
>  ((eq org-link-file-path-type 'relative)
>   (setq path (file-relative-name path)))
> +((eq org-link-file-path-type 'adaptive)
> + (setq path (file-relative-name path)))
>  (t
>   (save-match-data
> (if (string-match (concat "^" (regexp-quote

Would you writing a few tests?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] document org-at-heading-p

2018-11-01 Thread Nicolas Goaziou
Hello,

Will Pierce  writes:

> * add brief docstring pointing to outline-on-heading
> From 41796f33d083367bf99303cb8d33f289472825b5 Mon Sep 17 00:00:00 2001
> From: pierwill <19642016+pierw...@users.noreply.github.com>
> Date: Thu, 1 Nov 2018 10:08:35 -0500
> Subject: [PATCH] document org-at-heading-p

I added the missing docstring.

> * add brief docstring pointing to outline-on-heading

I disagree with this.  This is an implementation detail.

Thank you!

Regards,

-- 
Nicolas Goaziou



Re: [O] Full-width characters break column display

2018-11-01 Thread Nicolas Goaziou
Hello,

Leo Gaspard  writes:

> Small issue I've been having with org-mode: full-width characters
> (eg. 何か) appear to be breaking column display.

Org tables assume a fixed-width font.  You need to use one, if such
thing exists for these characters.

Regards,

-- 
Nicolas Goaziou



Re: [O] FW: [RFC] Link-type for attachments, more attach options

2018-11-01 Thread Marco Wahl
Hi Gustav,

I played a bit with your proposition.  I like it; in particular the
completion function to insert links from the attachment directory with

C-c C-l attached RET

It seems natural to me to have a more specific link type for attached
files.

In my opinion your patch should be applied to the 'next' branch.


My 2ct,
Marco





[O] Full-width characters break column display

2018-11-01 Thread Leo Gaspard
Hello,

Small issue I've been having with org-mode: full-width characters
(eg. 何か) appear to be breaking column display.

Does anyone know of a workaround for this?

Cheers, and thank you for making org-mode as great as I'm currently
discovering it is!
Leo



[O] [PATCH] clocktable thinks Oct 29 is Oct 28 [9.1.14 (release_9.1.14-1012-g643481 @ /home/unhammer/src/org-mode/lisp/)]

2018-11-01 Thread Kevin Brubeck Unhammer
The attached patch solves this, as far as I can tell.

I have signed the FSF copyright papers.

best regards,
Kevin Brubeck Unhammer


From e818cd5d1c651a516a0e791a10d91fe1e310cde9 Mon Sep 17 00:00:00 2001
From: Kevin Brubeck Unhammer 
Date: Thu, 1 Nov 2018 13:59:09 +0100
Subject: [PATCH] org-clock: Handle DST in clocktable

* lisp/org-clock.el (org-clocktable-steps): new fn
  org-clocktable-increment-day to add/subtract days that are not
  exactly 24 hours
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/step): Add
  test for DST.
---
 lisp/org-clock.el  | 27 +++
 testing/lisp/test-org-clock.el | 21 -
 2 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 420fdadfe..6292a259f 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2681,6 +2681,15 @@ LEVEL is an integer.  Indent by two spaces per level above 1."
   (if (= level 1) ""
 (concat "\\_" (make-string (* 2 (1- level)) ?\s
 
+(defun org-clocktable-increment-day (ts &optional n)
+  "Increment day in TS by N (defaulting to 1).
+The TS argument has the same type as the return values of
+`float-time' or `current-time'."
+  (let ((tsd (decode-time ts)))
+(cl-incf (nth 3 tsd) (or n 1))
+(setf (nth 8 tsd) nil) ; no time zone: increasing day skips one whole day
+(apply 'encode-time tsd)))
+
 (defun org-clocktable-steps (params)
   "Step through the range to make a number of clock tables."
   (let* ((ts (plist-get params :tstart))
@@ -2688,7 +2697,6 @@ LEVEL is an integer.  Indent by two spaces per level above 1."
 	 (ws (plist-get params :wstart))
 	 (ms (plist-get params :mstart))
 	 (step0 (plist-get params :step))
-	 (step (cdr (assq step0 '((day . 86400) (week . 604800)
 	 (stepskip0 (plist-get params :stepskip0))
 	 (block (plist-get params :block))
 	 cc tsb)
@@ -2715,16 +2723,19 @@ LEVEL is an integer.  Indent by two spaces per level above 1."
 	  (if (eq step0 'week)
 	  (let ((dow (nth 6 (decode-time (seconds-to-time ts)
 		(if (<= dow ws) ts
-		  (- ts (* 86400 (- dow ws)
+		  (org-clocktable-increment-day ts ; decrement
+		(- ws dow
 	ts))
 (while (< tsb te)
   (unless (bolp) (insert "\n"))
-  (let ((start-time (seconds-to-time (max tsb ts
-	(cl-incf tsb (let ((dow (nth 6 (decode-time (seconds-to-time tsb)
-		   (if (or (eq step0 'day)
-			   (= dow ws))
-			   step
-			 (* 86400 (- ws dow)
+  (let* ((start-time (seconds-to-time (max tsb ts)))
+	 (dow (nth 6 (decode-time (seconds-to-time tsb
+	 (days-to-skip (cond ((eq step0 'day) 1)
+ ;; else 'week:
+ ((= dow ws) 7)
+ (t (- ws dow)
+	(setq tsb (time-to-seconds (org-clocktable-increment-day tsb
+ days-to-skip)))
 	(insert "\n"
 		(if (eq step0 'day) "Daily report: "
 		  "Weekly report starting on: ")
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index abb3637bd..ddc135669 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -977,7 +977,26 @@ CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] =>  8:00"
 	(let ((system-time-locale "en_US"))
 	  (test-org-clock-clocktable-contents
 		  (concat ":step day :tstart \"<2017-12-25 Mon>\" "
-			  ":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t")))
+			  ":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t"))
+  ;; Regression test: Respect DST
+  (should
+   (equal "
+Daily report: [2018-10-29 Mon]
+| Headline | Time   |
+|--+|
+| *Total time* | *8:00* |
+|--+|
+| Foo  | 8:00   |
+"
+	  (org-test-with-temp-text
+	  "* Foo
+CLOCK: [2018-10-29 Mon 08:00]--[2018-10-29 Mon 16:00] =>  8:00"
+	(let ((system-time-locale "en_US"))
+	  (test-org-clock-clocktable-contents
+		  (concat ":step day "
+			  ":stepskip0 t "
+			  ":tstart \"2018-10-01\" "
+			  ":tend \"2018-11-01\"")))
 
 (ert-deftest test-org-clock/clocktable/extend-today-until ()
   "Test assignment of clock time to days in presence of \"org-extend-today-until\"."
-- 
2.17.1



signature.asc
Description: PGP signature


[O] [PATCH] document org-at-heading-p

2018-11-01 Thread Will Pierce
* add brief docstring pointing to outline-on-heading


0001-document-org-at-heading-p.patch
Description: Binary data


Re: [O] getting close on latex letterheads [was: letterhead and signature in odt export]

2018-11-01 Thread Eric S Fraga
Cannot help you on this but I did enjoy reading the references for the
students! :-)
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4



Re: [O] Best way to process a collection of .org files as one?

2018-11-01 Thread Matt Price
This isn't really an answer to your question, but I keep all my lectures
for each course in a single file, then export subtrees when I need them.
For me, this works well.   I have recently started using a -dwim export
scope based on Kaushal's org-hugo-export-dwim functions.  But... I seem to
have lost the code, drat!  Anyway, I will write it up again sometime
soon I hope. It's a conveinence function that looks for a an EXPORT_FILE
property in the parents of the current subtree and chooses that as the
export scope. I had written -- I think i a lost scratch buffer! -- versions
for both reveal and my derived "huveal" backend which sends my slides to a
website.

On Thu, Nov 1, 2018 at 7:16 AM Nik Clayton  wrote:

> Hoi,
>
> What's the best way to process (ideally using the org-element API) a
> collection of .org files as one larger file?
>
> I'm using Org + ox-reveal to write the course material for a three month
> course. This is a lot of material, so keeping it in one Org file is not
> practical (exporting it to the slides takes longer, it's easier to have
> multiple buffers open and switch between them, etc).
>
> To help ensure that I'm covering the content in a sensible order I've
> given each heading optional TOPIC and REQUIREMENTS properties. When a new
> topic is introduced I add an identifier to the TOPIC property to the
> heading that introduces it, and if a heading requires that a topic or
> topics have been introduced I add the topic identifiers as a
> space-separated string to the REQUIREMENTS property.
>
> I have a small function that uses the org-element API to iterate over all
> the headings in a file and tell if if I have any headings that list a
> requirement without that requirement appearing in a TOPIC property earlier
> in the file.
>
> This works when the file is self contained.
>
> When I have topics that might be introduced in one file, and later
> referenced in a second file, it obviously doesn't.
>
> I thought one approach would be to have a master Org file that references
> all the others, so course.org that looks like:
>
> #+INCLUDE "day1.org"
> #+INCLUDE "day2.org"
> #+INCLUDE "day3.org"
> ...
>
> However, org-element-parse-buffer doesn't recurse in to the included
> files, so this doesn't work.
>
> I could write my own function to create the recursive expansion of all the
> content, but before I do that I thought I'd check to see if there's a
> better way of doing what I'm trying to achieve.
>
> Any ideas?
>
> N
>


[O] getting close on latex letterheads [was: letterhead and signature in odt export]

2018-11-01 Thread Matt Price
OK, so I'm getting close to being able to do this. My almost-working
example doc is at the bottom of this email, I have a question about
suppressing the headline text.

On Tue, Oct 30, 2018 at 11:50 PM ckelty ckelty  wrote:

> Matt,
>
>
> > On Oct 30, 2018, at 6:26 PM, Matt Price  wrote:
> >
> > Hi again Chris!
> >
> > OK, so I understand a little bit of this. I would like to keep all my
> letters in subheadings in a single org doc, and just export once. This
> version requires a fair amount of latex in every subtree.
>
> Unless I am misunderstanding, you should be able to restrict what you
> export to your subtree with a C-s (C-c C-e C-s l o) and just have one file
> with the Latex Headers at the top… or you can do what Tim suggested and put
> it in org-latex-classes variable (but I don’t know how to do that).
>
> I think I may actually understand this now.  See my example below, which
almost works.

>
> >
> > Also... where should I go to learn more about latex (I have
> beengoogling, I've found some places, am wondering what the *best* place
> is)? It appears I am approaching adulthood and am ready to learn how to use
> it, after years of resisting :-/
> >
>
> Ahhh… that way lies madness.  Welcome.  I would learn as little LaTeX as
> necessary and allow org to do the rest.  ShareLatex, Overleaf, and
> StackExchange are all fine starting points
>
> I'm definitely learning something, though yes, I feel a bit like the Mad
Hatter.

So I am pretty close.  As you suggested, turns out I can put almost all the
latex in the document header.  The only thing that still needs to go into
the letter body is the \mysig command that I have defined in the header.

This works fine if I have no headlines in the letter text, but if I try to
export a subtree, then I guess the headline gets read as a title, and
either org or latex inserts it immediately after my custom \maketitle
command.

It seems to me then that I either have to always set the export_title
property of subheadings to the empty string; add a temporary filter to
ox-latex; or just write my own derived backend that does al lthis work for
me, and maybe add a keybinding for that to make it easier to access (my
export dispatcher is getting pretty crowded...).  Setting #+OPTIONS:
title:nil does not seem ot have any effect :-(

Still, maybe some of y'all have ideas on how to improve what I've already
got, which is below. Thanks again!

#+STARTUP: indent
#+LANGUAGE: en
#+OPTIONS: num:nil  toc:nil ':t
#+AUTHOR
#+EMAIL: Your Email Here
#+LATEX_HEADER: \usepackage[utf8]{inputenc}
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage{graphicx}
#+LATEX_HEADER: \usepackage{float}
#+LATEX_HEADER: \usepackage{wrapfig}
#+LATEX_HEADER: \usepackage{rotating}
#+LATEX_HEADER: \usepackage[normalem]{ulem}
#+LATEX_HEADER: \usepackage{hyperref}
#+LATEX_HEADER: \usepackage{setspace}
#+LATEX_HEADER: \usepackage{libertine}
#+LATEX_HEADER: \usepackage[left=1.0in,right=1.0in]{geometry}
#+LATEX_HEADER: \setlength{\parskip}{1em}
#+LATEX_HEADER: \setlength{\parindent}{0pt}
#+LATEX_HEADER:
\newenvironment{temphelvet}{\fontfamily{phv}\selectfont}{\par}
#+LATEX_HEADER: \makeatletter
#+LATEX_HEADER: \def\@maketitle{
#+LATEX_HEADER: \begin{minipage}{0.14\textwidth}
#+LATEX_HEADER:
\includegraphics[width=1.8cm]{./Pictures/1201010701CF636AB597708AB63A.png}
#+LATEX_HEADER: \end{minipage}
#+LATEX_HEADER: \begin{minipage}{0.86\textwidth}
#+LATEX_HEADER: \begin{temphelvet}
#+LATEX_HEADER: {\huge University of Toronto}
#+LATEX_HEADER: \vspace{-2pt}
#+LATEX_HEADER: \hrule
#+LATEX_HEADER: \vspace{3pt}
#+LATEX_HEADER: \textbf{\textsc{dept. of history}}  \newline
#+LATEX_HEADER: {\small \textsc{ Rm. 2074 sidney smith, 100 st. george
street}, TORONTO, ONTARIO  M5S 3G3  CANADA \newline
#+LATEX_HEADER: \textsc{Telephone 416-978-3363Fax 416-978-4810} }
#+LATEX_HEADER: \end{temphelvet}
#+LATEX_HEADER: \end{minipage}
#+LATEX_HEADER: \hfill}
#+LATEX_HEADER: \makeatother
#+LATEX_HEADER: \newcommand{\mysig}{
#+LATEX_HEADER: Please do not hesitate to contact me with any questions or
concerns.\\
#+LATEX_HEADER: Sincerely,\\
#+LATEX_HEADER: \fromsig{\includegraphics[scale=1]{my-sig.png}} \\
#+LATEX_HEADER: \fromname{Matt Price}
#+LATEX_HEADER: }
#

#+LATEX_HEADER_EXTRA:  \maketitle
# #+LATEX_HEADER_EXTRA: \onehalfspacing


* Frankie
I had the pleasure of teaching Frankie Goes To Hollywood in my 4th year
seminar in Spring of 1987. Frankie stood out then as now as one of the
loudest students I had ever encountered. At the same time, Frankie's work
forced me to confront my own inability to *relax*. After years of
psychotherapy, I now believe that that seminar was one of the best parts of
my life.  All the "trauma" Frankie caused me turn out to have been
excellent learning experiences.

It is thus with great pleasure that my therapist, I mean I, recommend
Frankie for your stupid fellowship.

\mysig

* Joey
Joey Ramone was a student in my class "School's out for Summer" at /Rock
and Roll High S

[O] Best way to process a collection of .org files as one?

2018-11-01 Thread Nik Clayton
Hoi,

What's the best way to process (ideally using the org-element API) a
collection of .org files as one larger file?

I'm using Org + ox-reveal to write the course material for a three month
course. This is a lot of material, so keeping it in one Org file is not
practical (exporting it to the slides takes longer, it's easier to have
multiple buffers open and switch between them, etc).

To help ensure that I'm covering the content in a sensible order I've given
each heading optional TOPIC and REQUIREMENTS properties. When a new topic
is introduced I add an identifier to the TOPIC property to the heading that
introduces it, and if a heading requires that a topic or topics have been
introduced I add the topic identifiers as a space-separated string to the
REQUIREMENTS property.

I have a small function that uses the org-element API to iterate over all
the headings in a file and tell if if I have any headings that list a
requirement without that requirement appearing in a TOPIC property earlier
in the file.

This works when the file is self contained.

When I have topics that might be introduced in one file, and later
referenced in a second file, it obviously doesn't.

I thought one approach would be to have a master Org file that references
all the others, so course.org that looks like:

#+INCLUDE "day1.org"
#+INCLUDE "day2.org"
#+INCLUDE "day3.org"
...

However, org-element-parse-buffer doesn't recurse in to the included files,
so this doesn't work.

I could write my own function to create the recursive expansion of all the
content, but before I do that I thought I'd check to see if there's a
better way of doing what I'm trying to achieve.

Any ideas?

N


Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Philip Hudson
Two further thoughts:

1. That regexp works but it should really start with "^":

  (org-capture-verify-tree (replace-regexp-in-string "^#\+[^\n]*\n" ""
template))

2. The fix I propose is a kludge. The real problem is the semantics of
function `org-capture-insert-template-here'. My assertion: there is no
reason to believe that a completed template of type 'entry must be a
subtree in the sense of the contract of function
`org-kill-is-subtree-p'. In other words, function
`org-kill-is-subtree-p' is meant for something else. We either need a
similar-but-different special-purpose entry-template verification
function, defined in 'org-capture.el' itself, or, if we can do so
without introducing other regressions, we need to modify function
`org-kill-is-subtree-p' to accept "#+KEYWORD" in-buffer settings.
On Mon, 29 Oct 2018 at 22:47, Philip Hudson  wrote:
>
> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
> https://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org mailing list.
> 
>
> Regression in org-capture template handling.
>
> I expected my (previously working) org-capture template to be
> inserted into a newly-created empty Org file. The file name and
> location are the output of a function specified in the template
> (sequentially numbered filename).
>
> Function `org-capture-insert-template-here' in file org-capture.el
> now errors if the template specifies that its type is 'entry and it
> begins with one or more lines of the general form "#+KEY value".
> The error traces to a call to `org-kill-is-subtree-p', defined in file
> org.el.
>
> Fix (sorry it's not a proper patch):
>
> Change line 1399 of org-capture.el from:
>
>(org-capture-verify-tree (org-capture-get :template))
>
> to:
>
>(org-capture-verify-tree (replace-regexp-in-string "#\+[^\n]*\n" ""
> template))
>
> (This includes a refactoring-out of that redundant call to `org-capture-get').
>
> NOTE: I have signed the FSF papers. In fact I've made small
> contributions to Org-mode previously.
>
> Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
> of 2017-09-12 on hullmann, modified by Debian
> Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @
> /home/phil/.emacs.d/elpa/org-9.1.14/)
>
> --
> Phil Hudson  http://hudson-it.ddns.net
> Pretty Good Privacy (PGP) ID: 0x4E482F85



-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85