[O] [PATCH] Silence byte-compiler under "make single"

2017-05-25 Thread Kyle Meyer
Kyle Meyer  writes:

> With 'make single' on master, I get a compile error due to the
> eval-when-compile's added in 53ee147f4 (Add support for new switches to
> org-get-heading, 2017-01-17) and 6dc6eb3b0 (Fix failing test,
> 2017-01-19).
>
> In toplevel form:
> org.el:7914:51:Error: Symbol’s value as variable is void: 
> org-comment-string
>
> If I wrap (defconst org-comment-string ...) in eval-and-compile to get
> rid of those, I see your reported warning and a few others (but not the
> others that you reported):
>
> In org-at-timestamp-p:
> org.el:17946:40:Warning: reference to free variable
> ‘org-agenda-include-inactive-timestamps’
> 
> In org--get-expected-indentation:
> org.el:22608:28:Warning: reference to free variable
> ‘org-element-greater-elements’
> 
> In end of data:
> org.el:24980:1:Warning: the following functions are not known to be 
> defined:
> org-table-sort-lines, org-duration-from-minutes

The org-element-greater-elements warning was the only warning present on
maint, and that's covered by 6d4c188e3 now on the tip of maint.  The
following patch should take care of the rest of the "make single" issues
on master (with Emacs 25.2, at least).

-- >8 --
Subject: [PATCH] Silence byte-compiler under "make single"

* lisp/org.el (org-comment-string): Wrap definition in an
eval-and-compile because this variable is used within the body of
eval-when-compile, leading to an error under "make single".
(org-at-timestamp-p): Use bound-and-true-p to check
org-agenda-include-inactive-timestamps because org-agenda may not be
loaded yet.

Reported-by: Kaushal Modi 

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

diff --git a/lisp/org.el b/lisp/org.el
index a50966ea1..59cc9b4cb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -129,6 +129,8 @@ (declare-function org-clock-timestamps-down "org-clock" 
( n))
 (declare-function org-clock-timestamps-up "org-clock" ( n))
 (declare-function org-clock-update-time-maybe "org-clock" ())
 (declare-function org-clocktable-shift "org-clock" (dir n))
+(declare-function
+ org-duration-from-minutes "org-duration" (minutes  fmt canonical))
 (declare-function org-element-at-point "org-element" ())
 (declare-function org-element-cache-refresh "org-element" (pos))
 (declare-function org-element-cache-reset "org-element" ( all))
@@ -167,6 +169,9 @@ (declare-function org-table-maybe-recalculate-line 
"org-table" ())
 (declare-function org-table-next-row "org-table" ())
 (declare-function org-table-paste-rectangle "org-table" ())
 (declare-function org-table-recalculate "org-table" ( all noalign))
+(declare-function
+ org-table-sort-lines "org-table"
+ ( with-case sorting-type getkey-func compare-func interactive?))
 (declare-function org-table-wrap-region "org-table" (arg))
 (declare-function org-tags-view "org-agenda" ( todo-only match))
 (declare-function orgtbl-ascii-plot "org-table" ( ask))
@@ -525,11 +530,12 @@ (defconst org-archive-tag "ARCHIVE"
 An archived subtree does not open during visibility cycling, and does
 not contribute to the agenda listings.")
 
-(defconst org-comment-string "COMMENT"
-  "Entries starting with this keyword will never be exported.
+(eval-and-compile
+  (defconst org-comment-string "COMMENT"
+"Entries starting with this keyword will never be exported.
 \\
 An entry can be toggled between COMMENT and normal with
-`\\[org-toggle-comment]'.")
+`\\[org-toggle-comment]'."))
 
 
  LaTeX Environments and Fragments
@@ -17942,7 +17948,8 @@ (defun org-at-timestamp-p ( extended)
 (or (and (eq extended 'agenda)
  (or (org-at-planning-p)
  (org-at-property-p)
- (and org-agenda-include-inactive-timestamps
+ (and (bound-and-true-p
+   org-agenda-include-inactive-timestamps)
   (org-at-clock-log-p
 (eq 'timestamp
 (save-excursion
-- 
2.13.0





Re: [O] Fix org.el compilation warnings

2017-05-25 Thread Kyle Meyer
Kaushal Modi  writes:

> On Thu, May 25, 2017, 7:59 PM Kyle Meyer  wrote:
>
>> Kaushal Modi  writes:
>>
>> > I was trying to fix the org.el compilation warnings.
>>
>> I don't see any compiler warnings when I run 'make compile' with either
>> master (2960dc971) or maint (89bd7ad87) on Emacs 25.2.
>>
>
> Those warnings were on master using the latest build of emacs from master.
>
> I was compiling just org.el, may be that's why?

Ah, right ... 'make compile' uses a single Emacs instance, while 'make
single' uses a separate Emacs instance for each file.

With 'make single' on master, I get a compile error due to the
eval-when-compile's added in 53ee147f4 (Add support for new switches to
org-get-heading, 2017-01-17) and 6dc6eb3b0 (Fix failing test,
2017-01-19).

In toplevel form:
org.el:7914:51:Error: Symbol’s value as variable is void: org-comment-string

If I wrap (defconst org-comment-string ...) in eval-and-compile to get
rid of those, I see your reported warning and a few others (but not the
others that you reported):

In org-at-timestamp-p:
org.el:17946:40:Warning: reference to free variable
‘org-agenda-include-inactive-timestamps’

In org--get-expected-indentation:
org.el:22608:28:Warning: reference to free variable
‘org-element-greater-elements’

In end of data:
org.el:24980:1:Warning: the following functions are not known to be defined:
org-table-sort-lines, org-duration-from-minutes

I think all of these should be addressed.

> But even then, shouldn't the free variable warning, that I fix in the patch
> I just provided, be fixed?

Your patch is only the appropriate fix if we're confident that
org-agenda will be loaded at the time that the
org-agenda-include-inactive-timestamps code path of org-at-timestamp-p
is executed.  Otherwise, we're just silencing a warning about a possible
run-time void variable error.  Have you looked this?

-- 
Kyle



Re: [O] Citations with org-ref in apa style

2017-05-25 Thread John Kitchin
I guess you should change
#+LATEX_HEADER:
 \usepackage[citestyle=authoryear-icomp,bibstyle=authoryear,
 hyperref=true,backref=false,maxcitenames=3,url=true,
backend=biber,natbib=true]
 {biblatex}

to

#+LATEX_HEADER: \usepackage[american]{babel}

#+LATEX_HEADER: \usepackage{csquotes}#+LATEX_HEADER:
\usepackage[style=apa]{biblatex}#+LATEX_HEADER:
\DeclareLanguageMapping{american}{american-apa}

I am not a biber user. See
http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/biblatex-contrib/biblatex-apa/biblatex-apa.pdf
for more details.


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, May 25, 2017 at 3:57 PM, Lars Bjørndal  wrote:

> On Thu, May 25, 2017 at 05:36:07PM +0100, Eric S Fraga wrote:
> > On Thursday, 25 May 2017 at 11:47, Lars Bjørndal wrote:
> > > Hi, list!
> > >
> > > I'm currently writing an exam in org-mode with org-ref, installed from
> > > elpa. I think the institution expects to get the referances in apa
> > > style. So I wonder if I can do that, and how I can do it.
> >
> > Have you tried?  What happens?
>
> Well, to be honest, I don't know what to replace the line in question
> with. I'm a novice both in LaTeX and in org-mode/org-ref.
>
> Lars
>
>


Re: [O] Fix org.el compilation warnings

2017-05-25 Thread Kaushal Modi
On Thu, May 25, 2017, 7:59 PM Kyle Meyer  wrote:

> Kaushal Modi  writes:
>
> > I was trying to fix the org.el compilation warnings.
>
> I don't see any compiler warnings when I run 'make compile' with either
> master (2960dc971) or maint (89bd7ad87) on Emacs 25.2.
>

Those warnings were on master using the latest build of emacs from master.

I was compiling just org.el, may be that's why?

But even then, shouldn't the free variable warning, that I fix in the patch
I just provided, be fixed?

I'll try 'make compile' when I get to a computer.

> --

Kaushal Modi


Re: [O] Fix org.el compilation warnings

2017-05-25 Thread Kyle Meyer
Kaushal Modi  writes:

> I was trying to fix the org.el compilation warnings.

I don't see any compiler warnings when I run 'make compile' with either
master (2960dc971) or maint (89bd7ad87) on Emacs 25.2.

-- 
Kyle



[O] Git repository error

2017-05-25 Thread Vicente Vera
Hi. For a while i've been getting this error upon running 'make up0'
from my local Org repository:

fatal: read error: Connection reset by peer



[O] Fix org.el compilation warnings

2017-05-25 Thread Kaushal Modi
Hello,

I was trying to fix the org.el compilation warnings.

I could fix just this one:

>From 4e2de052dd05e66ed71ce070e4413859e2c13238 Mon Sep 17 00:00:00 2001
From: Kaushal Modi 
Date: Thu, 25 May 2017 18:24:34 -0400
Subject: [PATCH] org: Silence byte-compiler

* lisp/org.el (org-agenda-include-inactive-timestamps): Silence
  byte-compiler.
---
 lisp/org.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 946d8af8c..d1c70ab97 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -175,6 +175,8 @@ Stars are put in group 1 and the trimmed body in group
2.")
 (declare-function org-export-get-environment "ox" ( backend
subtreep ext-plist))
 (declare-function org-latex-make-preamble "ox-latex" (info 
template snippet?))

+(defvar org-agenda-include-inactive-timestamps) ;Silence byte-compiler
+
 (defsubst org-uniquify (list)
   "Non-destructively remove duplicate elements from LIST."
   (let ((res (copy-sequence list))) (delete-dups res)))
-- 
2.13.0


There are still these 4 warnings for org.el:

In org-goto-map:
org.el:7502:9:Warning: function org-goto-map used to take 0+ arguments, now
takes 0

In org-todo:
org.el:12488:12:Warning: function org-todo used to take 0+ arguments, now
takes 0-1

In org-store-log-note:
org.el:13725:8:Warning: function org-store-log-note used to take 0+
arguments,
now takes 0

In org-self-insert-command:
org.el:2:32:Warning: function org-self-insert-command used to take 0+
arguments, now takes 1

-- 

Kaushal Modi


Re: [O] Citations with org-ref in apa style

2017-05-25 Thread Lars Bjørndal
On Thu, May 25, 2017 at 05:36:07PM +0100, Eric S Fraga wrote:
> On Thursday, 25 May 2017 at 11:47, Lars Bjørndal wrote:
> > Hi, list!
> >
> > I'm currently writing an exam in org-mode with org-ref, installed from
> > elpa. I think the institution expects to get the referances in apa
> > style. So I wonder if I can do that, and how I can do it.
> 
> Have you tried?  What happens?

Well, to be honest, I don't know what to replace the line in question
with. I'm a novice both in LaTeX and in org-mode/org-ref.

Lars



[O] Cross references that output both section number and section name

2017-05-25 Thread Aaron Wenner
Hi all,

Does anyone know if it’s possible to create cross-references to sections in 
org-mode that contain (or export as) both the section number and the link text? 
For example:  

* This is heading 1
** This is heading 1.1

* New heading
[[*This is heading 1.1]] # Outputs as 1.1
[[*This is heading 1.1][This is heading 1.1]] # Outputs as "This is heading 
1.1"
Is there any way to create a link that outputs both examples at the same time: 
Eg: 1.1 This is heading 1.1

Thanks!

AW




Re: [O] [RFC] The "c" Org macro

2017-05-25 Thread Kaushal Modi
On Thu, May 25, 2017 at 6:42 AM Nicolas Goaziou 
wrote:

>
> Pushed.


Works great!  Thanks for fixing the auto-filling issue too.
-- 

Kaushal Modi


Re: [O] Citations with org-ref in apa style

2017-05-25 Thread Eric S Fraga
On Thursday, 25 May 2017 at 11:47, Lars Bjørndal wrote:
> Hi, list!
>
> I'm currently writing an exam in org-mode with org-ref, installed from
> elpa. I think the institution expects to get the referances in apa
> style. So I wonder if I can do that, and how I can do it.

Have you tried?  What happens?
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-425-gf4fca1


signature.asc
Description: PGP signature


Re: [O] popup buffer showing buffers headings?

2017-05-25 Thread Eric S Fraga
On Thursday, 25 May 2017 at 09:54, Sharon Kimble wrote:
> Is it possible to have a buffer showing the headers of a file in a
> buffer in a popup window to the left of the main window in org-mode
> please?

Try speedbar.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.7-468-g2b44a1.dirty


signature.asc
Description: PGP signature


Re: [O] Allow #+SETUPFILE to point to an URL for the org file

2017-05-25 Thread Kaushal Modi
I have attached an updated and rebased patch with most of your suggestions
implemented.

Comments below.

On Thu, May 25, 2017 at 7:43 AM Kaushal Modi  wrote:

> On Thu, May 25, 2017, 6:15 AM Nicolas Goaziou 
> wrote:
>
>> Interactive functions do not have double-dashes in their names. However,
>> I have concerns about this interactive status. Given than the function
>> is not properly documented in the manual, there is little chance it will
>> be actually used. And if it isn't, it could return surprising results.
>>
>> Another idea would be to replace NOCACHE with CLEAR-CACHE. When this is
>> non-nil, the cache is reset at the beginning of the function. The point
>> is to reset the cache the first time the function is called, but not on
>> recursive calls, which ensures any file is retrieved only once.
>
>
> Here is my use case for org-file-clear-cache:
>
> Let's say I have a file where I have a SETUPFILE retrieved from a URL. Now
> the upstream version changes but my cache is still on the older version. So
> I need to clear the hash. The org-file-clear-cache simply does that.
>
> With the function being interactive, I just do
>
> - M-x org-file-clear-cache
> - C-c C-e h h (or whatever I am exporting to)
>
> If you suggest a node where I should put that in the manual, I can add
> that to my updated patch. I'll all add more explanation to the doc-string
> of that function.
>
> Now, if the CLEAR-CACHE argument is added to org-file-clear-cache, how do
> we control the cache clearing interactively from outside?
>
> Also, how do we implement the resetting of the cache only the first time
> the function is called? Wouldn't that need an extra alist defvar to record
> the state of whether the function is already called specifically for that
> file? I think that would unnecessary complicate the logic.
>
> Another idea is that we have a defcustom like org-file-never-cache. When
> non-nil, that will always do a fresh URL download. This will be or'ed with
> the NOCACHE inside org-file-contents. This, though, makes it a bit
> inconvenient for the user to use the latest upstream version when they
> need... They might need to set org-file-never-cache to t momentarily,
> probably via Local Variables, before an export.
>
>  Of
>
> course the cache doesn't survive to multiple exports, but at least it is
>> transparent to the user.
>>
>
> Sorry, I didn't follow that. Did you mean that the cache doesn't survive
> between emacs sessions? Because the cache will actually survive between
> multiple exports.
>

This issue is still open. I have just added a bit more info to the
docstring of org-file-clear-cache.

I grepped org.texi but found no reference of org-file-contents. So may be
we need to add a section for that, and there I can explain
org-file-clear-cache in more detail. What would be a good node for that?


>   (if (re-search-forward "HTTP.*\\s-+200\\s-OK" nil t)
>>   ;; URL retrieved correctly.  Move point to after the
>>   ;; url-retrieve header, update the cache `org--file-cache'
>>   ;; and return contents.
>>   (progn
>> (search-forward "\n\n" nil 'move)
>
>
I have integrated most of your refactored version except for this portion.
Above will do a false match if that "HTTP.." string is present in the FILE
body too! I have retained my version of only that part where the search
happens only inside the url-retrieve header. The search is also faster in
the case of failure as it does not have to search through the whole file
before declaring a fail.. as only the header is searched.

> --

Kaushal Modi


0001-Allow-org-file-contents-to-fetch-file-contents-from-.patch
Description: Binary data


Re: [O] Documentation fix

2017-05-25 Thread Colin Baxter
Dear Nicolas,

> "NG" == Nicolas Goaziou  writes:

NG> Hello, Colin Baxter  writes:

>> I've appended (inline) the warnings associated with the
>> documentation output of 'make all', removing extraneous output.
>> 
>>  Begin  org-version: 9.0.7
>> (release_9.0.7-478-g30ceb5) makeinfo --no-split org.texi -o org
>> makeinfo --html --number-sections --no-split -o org.html org.texi
>> texi2pdf --batch --clean --expand org.texi -:1267: warning:
>> @itemx should not begin @table -:1345: warning: @table has text
>> but no @item

NG> [...]

>> 
>> The 'make all' process continues satisfactorily to its
>> conclusion.

NG> These are innocuous warnings.

>> Deleting the 'x' from 'itemx' in org.texi at the lines
>> corresponding to the warnings '@itemx should not begin @table',
>> that is, at lines 1267, 7819, 10342, removes those
>> warnings. That's all the patch did.

NG> This would be wrong. The @orgcmd macro above already introduces
NG> @item, so the second one really needs to be @itemx.

Yes, I see that.

NG> One solution would be to replace the @itemx ... with @xorgkey,
NG> @xorgcmd, or @xorgcmdnki depending on the needs. But then, it
NG> would fall-back to the other warning, i.e., a @table without any
NG> @item (all are @orgsomething macros).

NG> I'm no Texinfo expert, so I'm not sure what is the best way to
NG> handle this. Maybe also create a special macro that would create
NG> a table. It sounds convoluted, though.

I'll look at this more carefully and see what I can do - if anything. It
will have to wait until I have the time, though.

Best wishes,

Colin.

-- 
--
Colin Baxter
m43...@yandex.com
GnuPG fingerprint: 68A8 799C 0230 16E7 BF68  2A27 BBFA 2492 91F5 41C8



[O] Citations with org-ref in apa style

2017-05-25 Thread Lars Bjørndal
Hi, list!

I'm currently writing an exam in org-mode with org-ref, installed from
elpa. I think the institution expects to get the referances in apa
style. So I wonder if I can do that, and how I can do it.

In the .org file, I have a line like this, that I suppose I have to
change:

(all in one line)
#+LATEX_HEADER:
 \usepackage[citestyle=authoryear-icomp,bibstyle=authoryear, 
 hyperref=true,backref=false,maxcitenames=3,url=true,backend=biber,natbib=true]
 {biblatex}

With this line, the c-c c-e l p command compiles to pdf, according to
the following setting in my .emacs file:

(setq  org-latex-pdf-process
   '("pdflatex -interaction nonstopmode -output-directory %o %f"
   "biber %b"
   "pdflatex -interaction nonstopmode -output-directory %o %f"
   "pdflatex -interaction nonstopmode -output-directory %o %f"))

Org-mode version:
Org-mode version 8.2.10 (release_8.2.10 @
/usr/share/emacs/25.2/lisp/org/)

Thanks and regards, Lars



Re: [O] Allow #+SETUPFILE to point to an URL for the org file

2017-05-25 Thread Kaushal Modi
On Thu, May 25, 2017, 6:15 AM Nicolas Goaziou 
wrote:

> Interactive functions do not have double-dashes in their names. However,
> I have concerns about this interactive status. Given than the function
> is not properly documented in the manual, there is little chance it will
> be actually used. And if it isn't, it could return surprising results.
>
> Another idea would be to replace NOCACHE with CLEAR-CACHE. When this is
> non-nil, the cache is reset at the beginning of the function. The point
> is to reset the cache the first time the function is called, but not on
> recursive calls, which ensures any file is retrieved only once.


Here is my use case for org-file-clear-cache:

Let's say I have a file where I have a SETUPFILE retrieved from a URL. Now
the upstream version changes but my cache is still on the older version. So
I need to clear the hash. The org-file-clear-cache simply does that.

With the function being interactive, I just do

- M-x org-file-clear-cache
- C-c C-e h h (or whatever I am exporting to)

If you suggest a node where I should put that in the manual, I can add that
to my updated patch. I'll all add more explanation to the doc-string of
that function.

Now, if the CLEAR-CACHE argument is added to org-file-clear-cache, how do
we control the cache clearing interactively from outside?

Also, how do we implement the resetting of the cache only the first time
the function is called? Wouldn't that need an extra alist defvar to record
the state of whether the function is already called specifically for that
file? I think that would unnecessary complicate the logic.

Another idea is that we have a defcustom like org-file-never-cache. When
non-nil, that will always do a fresh URL download. This will be or'ed with
the NOCACHE inside org-file-contents. This, though, makes it a bit
inconvenient for the user to use the latest upstream version when they
need... They might need to set org-file-never-cache to t momentarily,
probably via Local Variables, before an export.

 Of

course the cache doesn't survive to multiple exports, but at least it is
> transparent to the user.
>

Sorry, I didn't follow that. Did you mean that the cache doesn't survive
between emacs sessions? Because the cache will actually survive between
multiple exports.

>
Yet another idea is to add a time-to-live to cached values and remove
> them from cache past it. However, I prefer the idea above.
>


The specific reason is, as you noticed, %S wraps file name within double
> quotes. IMO, `...' would be for symbols or key bindings.
>

I'll replace `%s' with "%S".. I just liked the curly quotes created by ` '.
But if that breaks a convention, I rather not do that.

`prog1' is difficult to read when the first SEXP is large. Also, we
> should avoid splitting error messages and constructing them back, for
> hypothetical i18n considerations.
>
> I suggest the following re-factoring, where I limited the number of
> bindings and remove some trivial comments.
>
>   (defun org-file-contents (file  noerror nocache)
> "Return the contents of FILE, as a string.
>
>   FILE can be a file name or URL.
>
>   If FILE is a URL, download the contents.  If the URL contents are
>   already cached in the `org--file-cache' hash table, the download step
>   is skipped.
>
>   If NOERROR is non-nil, ignore the error when unable to read the FILE
>   from file or URL.
>
>   If NOCACHE is non-nil, do a fresh fetch of FILE even if cached version
>   is available.  This option applies only if FILE is a URL."
> (let* ((is-url (org-file-url-p file))
>(cache (and is-url
>(not nocache)
>(gethash file org--file-cache
>   (cond
>(cache)
>(is-url
> (with-current-buffer (url-retrieve-synchronously file)
>   (goto-char (point-min))
>   (if (re-search-forward "HTTP.*\\s-+200\\s-OK" nil t)
>   ;; URL retrieved correctly.  Move point to after the
>   ;; url-retrieve header, update the cache `org--file-cache'
>   ;; and return contents.
>   (progn
> (search-forward "\n\n" nil 'move)
> (puthash file
>  (buffer-substring-no-properties (point)
> (point-max))
>  org--file-cache))
> (funcall (if noerror #'message #'user-error)
>  (format "Unable to fetch file from %S" file)
>(t
> (with-temp-buffer
>   (condition-case err
>   (progn (insert-file-contents file) (buffer-string))
> (file-error
>  (funcall (if noerror #'message #'user-error)
>   (error-message-string err)
>
> I'm not sure about the return value when NOERROR is non-nil, but it may
> not matter, per the suggestion above.
>

I'll integrate your suggestion.

> Do we need to update the code using org-file-contents in these places:

Re: [O] popup buffer showing buffers headings?

2017-05-25 Thread Kaushal Modi
On Thu, May 25, 2017, 5:55 AM Sharon Kimble 
wrote:

>
> Is it possible to have a buffer showing the headers of a file in a
> buffer in a popup window to the left of the main window in org-mode
> please?
>

Yes, there is a package that does that. Check out imenu-list.

We already have 'neotree' but that just shows the files in a directory.
> What I'm looking for is something like 'Imenu' but in a popup buffer,
>

Yup, exactly that.

which is activated in something like 'M-F8' and displays, and then when
> 'M-F8' is used again it closes the popup.


M-x imenu-list does that by default. You can bind a key of your choice to
that.

Ideally, this could be used for any buffer that is being used, whether
> its latex, mediawiki, or whatever, although possibly not for gnus.
>

Yes, this package is generic, for imenu.


That said, for the purpose of jumping to headings, I like the newly added
counsel-org-goto command added to the counsel package.
-- 

Kaushal Modi


Re: [O] popup buffer showing buffers headings?

2017-05-25 Thread Nicolas Goaziou
Hello,

Sharon Kimble  writes:

> Is it possible to have a buffer showing the headers of a file in a
> buffer in a popup window to the left of the main window in org-mode
> please?

Maybe `org-goto' (C-c C-j) is what is you are looking for.

Regards,

-- 
Nicolas Goaziou



Re: [O] [RFC] The "c" Org macro

2017-05-25 Thread Nicolas Goaziou
Nicolas Goaziou  writes:

> Here is the last update, with tests and an ORG-NEWS entry. Noteworthy
> change: the "c" macro is now the "n" macro.
>
> If there are no objection nor additional suggestions, I will push it to
> master in a couple of days.

Pushed.



Re: [O] Allow #+SETUPFILE to point to an URL for the org file

2017-05-25 Thread Nicolas Goaziou
Correcting myself,

Nicolas Goaziou  writes:

>   (cond
>(cache)
>(is-url
> (with-current-buffer (url-retrieve-synchronously file)
>   (goto-char (point-min))
>   (if (re-search-forward "HTTP.*\\s-+200\\s-OK" nil t)
>   ;; URL retrieved correctly.  Move point to after the
>   ;; url-retrieve header, update the cache `org--file-cache'
>   ;; and return contents.
>   (progn
> (search-forward "\n\n" nil 'move)
> (puthash file
>  (buffer-substring-no-properties (point) (point-max))
>  org--file-cache))
> (funcall (if noerror #'message #'user-error)
>  (format "Unable to fetch file from %S" file)

Err.

  (funcall (if noerror #'message #'user-error)
   "Unable to fetch file from %S"
   file)

Also, in your patch,

"Test whether FILE is a URL.
  Return non-nil if it is."

  ->

"Non-nil if FILE is a URL."



Re: [O] Allow #+SETUPFILE to point to an URL for the org file

2017-05-25 Thread Nicolas Goaziou
Hello,

Kaushal Modi  writes:

> I have attached a patch following your recommendation. Please review
> it.

Thank you. Comments follow.

>> `org--setupfile-clear-cache' or `org-setupfile--clear-cache' depending
>> on the location of the function.
>
> This is an interactive, a user-facing function; do we want to add
> double-dashes in that name? The function is now called org-file-clear-cache.

Interactive functions do not have double-dashes in their names. However,
I have concerns about this interactive status. Given than the function
is not properly documented in the manual, there is little chance it will
be actually used. And if it isn't, it could return surprising results.

Another idea would be to replace NOCACHE with CLEAR-CACHE. When this is
non-nil, the cache is reset at the beginning of the function. The point
is to reset the cache the first time the function is called, but not on
recursive calls, which ensures any file is retrieved only once. Of
course the cache doesn't survive to multiple exports, but at least it is
transparent to the user.

Yet another idea is to add a time-to-live to cached values and remove
them from cache past it. However, I prefer the idea above.

> I tried (org-file-remote-p "http://foo.bar;) but it returned nil. Looks
> like both org-file-remote-p and file-remote-p will not work for URLs.

OK.

> setupfile is always a string so I used %s. If setupfile is not a string
> (may be nil?), then the very first string-match-p will through an error. Is
> there a specific reason for using %S? I did not use %S because I did not
> want the double-quotes to be printed around the string in the echo
> area.

The specific reason is, as you noticed, %S wraps file name within double
quotes. IMO, `...' would be for symbols or key bindings.

> Correct. The attached patch has everything integrated in
> org-file-contents.

`prog1' is difficult to read when the first SEXP is large. Also, we
should avoid splitting error messages and constructing them back, for
hypothetical i18n considerations.

I suggest the following re-factoring, where I limited the number of
bindings and remove some trivial comments.

  (defun org-file-contents (file  noerror nocache)
"Return the contents of FILE, as a string.

  FILE can be a file name or URL.

  If FILE is a URL, download the contents.  If the URL contents are
  already cached in the `org--file-cache' hash table, the download step
  is skipped.

  If NOERROR is non-nil, ignore the error when unable to read the FILE
  from file or URL.

  If NOCACHE is non-nil, do a fresh fetch of FILE even if cached version
  is available.  This option applies only if FILE is a URL."
(let* ((is-url (org-file-url-p file))
   (cache (and is-url
   (not nocache)
   (gethash file org--file-cache
  (cond
   (cache)
   (is-url
(with-current-buffer (url-retrieve-synchronously file)
  (goto-char (point-min))
  (if (re-search-forward "HTTP.*\\s-+200\\s-OK" nil t)
  ;; URL retrieved correctly.  Move point to after the
  ;; url-retrieve header, update the cache `org--file-cache'
  ;; and return contents.
  (progn
(search-forward "\n\n" nil 'move)
(puthash file
 (buffer-substring-no-properties (point) (point-max))
 org--file-cache))
(funcall (if noerror #'message #'user-error)
 (format "Unable to fetch file from %S" file)
   (t
(with-temp-buffer
  (condition-case err
  (progn (insert-file-contents file) (buffer-string))
(file-error
 (funcall (if noerror #'message #'user-error)
  (error-message-string err)

I'm not sure about the return value when NOERROR is non-nil, but it may
not matter, per the suggestion above.

> Do we need to update the code using org-file-contents in these places:

What do you meant by "update"?

Regards,

-- 
Nicolas Goaziou



[O] popup buffer showing buffers headings?

2017-05-25 Thread Sharon Kimble

Is it possible to have a buffer showing the headers of a file in a
buffer in a popup window to the left of the main window in org-mode
please?

We already have 'neotree' but that just shows the files in a directory.
What I'm looking for is something like 'Imenu' but in a popup buffer,
which is activated in something like 'M-F8' and displays, and then when
'M-F8' is used again it closes the popup. From the popup you can move
about the headings in your file with ease just using the keyboard, and
without having to use a mouse.

Ideally, this could be used for any buffer that is being used, whether
its latex, mediawiki, or whatever, although possibly not for gnus.

So can it be done please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.0, fluxbox 1.3.5-2, emacs 25.1.1.1, org-mode 9.0.7


signature.asc
Description: PGP signature


Re: [O] org-publish-attachment doesn't follow symbolic links anymore

2017-05-25 Thread Nicolas Goaziou
Hello,

Julien Cubizolles  writes:

> I'm using symbolic links in a directory managed by
> org-publish-attachment. As of a few weeks ago, org-publish-attachment
> doesn't upload the files linked to to the ftp server like it used
> to. There is no error message, only:
>
> Copying filename.pdf to /ftp:login@ftpserver:/dir/...done
>
> but the file isn't uploaded.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] clock-table property column empty

2017-05-25 Thread Nicolas Goaziou
Hello,

Nikolay Kudryavtsev  writes:

> Ok, this was due to me not running make in the repo first.
>
> Still I have another problem - I get two extra columns in the
> clocktable. See the attached test.org file.

This is expected since you specify ":maxlevel 4".

Regards,

-- 
Nicolas Goaziou0x80A93738