Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
> Please let me know if anything went wrong.

I think your refactor improves the original code a lot and makes clear
that toggling is just a special case.

I've been testing the changes with a pretty complex beamer document
and found no fault.

Thanks!



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Carlos Pita  writes:

> Nicolas, here is a patch implementing alternative B above with
> ORG-NEWS entry and everything.
>
> I have been playing with it and find the bindings quite handy.
>
> Code is indeed a bit simpler.
>
> If you like it, feel free to amend it before merging.

Thank you.

I eventually merged both alternatives, refactored some code and renamed
a few functions.

Please let me know if anything went wrong.



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
Nicolas, here is a patch implementing alternative B above with
ORG-NEWS entry and everything.

I have been playing with it and find the bindings quite handy.

Code is indeed a bit simpler.

If you like it, feel free to amend it before merging.

Best regards
--
Carlos
From 799ecd332e81a31b06f69ba5546db74eb9583ba7 Mon Sep 17 00:00:00 2001
From: memeplex 
Date: Wed, 13 Feb 2019 16:26:46 -0300
Subject: [PATCH] org: Make latex preview toggle more useful and predictable

* lisp/org.el (org-toggle-latex-fragment):
  - Avoid toggling behavior for subtree/buffer scope
  - Make common use cases simpler to type

* Detailed discussion:

  http://lists.gnu.org/archive/html/emacs-orgmode/2019-02/msg00138.html
---
 lisp/org.el | 71 ++---
 1 file changed, 35 insertions(+), 36 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 003058434..afd3f8709 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18057,60 +18057,59 @@ overlays were removed, nil otherwise."
 overlays))
 
 (defun org-toggle-latex-fragment ( arg)
-  "Preview the LaTeX fragment at point, or all locally or globally.
-
-If the cursor is on a LaTeX fragment, create the image and overlay
-it over the source code, if there is none.  Remove it otherwise.
-If there is no fragment at point, display all fragments in the
-current section.
-
-With prefix ARG, preview or clear image for all fragments in the
-current subtree or in the whole buffer when used before the first
-headline.  With a prefix ARG `\\[universal-argument] \
-\\[universal-argument]' preview or clear images
-for all fragments in the buffer."
+  "Toggle preview of the LaTeX fragment at point.
+
+If the cursor is on a LaTeX fragment, create the image and
+overlay it over the source code, if there is none.  Remove it
+otherwise.
+
+If there is no fragment at point, display image for all fragments
+in the current section.
+
+With prefix ARG, clear image for all fragments in the current
+subtree.
+
+With double prefix ARG, display image for all fragments in the
+buffer.
+
+With triple prefix ARG, clear image for all fragments in the
+buffer."
   (interactive "P")
   (when (display-graphic-p)
 (catch 'exit
   (save-excursion
 	(let (beg end msg)
 	  (cond
-	   ((or (equal arg '(16))
-		(and (equal arg '(4))
-		 (org-with-limited-levels (org-before-first-heading-p
-	(if (org-remove-latex-fragment-image-overlays)
-		(progn (message "LaTeX fragments images removed from buffer")
-		   (throw 'exit nil))
-	  (setq msg "Creating images for buffer...")))
-	   ((equal arg '(4))
+	   ((member arg '((16) (64)))	; Double or triple prefix
+	(when (org-remove-latex-fragment-image-overlays)
+	  (message "LaTeX fragments images removed from buffer"))
+	(when (equal arg '(64)) (throw 'exit nil))
+	(setq msg "Creating images for buffer..."))
+	   ((member arg '((4)))		; Single prefix
 	(org-with-limited-levels (org-back-to-heading t))
 	(setq beg (point))
 	(setq end (progn (org-end-of-subtree t) (point)))
-	(if (org-remove-latex-fragment-image-overlays beg end)
-		(progn
-		  (message "LaTeX fragment images removed from subtree")
-		  (throw 'exit nil))
-	  (setq msg "Creating images for subtree...")))
+	(when (org-remove-latex-fragment-image-overlays beg end)
+	  (message "LaTeX fragment images removed from subtree"))
+	(throw 'exit nil))
 	   ((let ((datum (org-element-context)))
 	  (when (memq (org-element-type datum)
 			  '(latex-environment latex-fragment))
 		(setq beg (org-element-property :begin datum))
 		(setq end (org-element-property :end datum))
-		(if (org-remove-latex-fragment-image-overlays beg end)
-		(progn (message "LaTeX fragment image removed")
-			   (throw 'exit nil))
-		  (setq msg "Creating image...")
+		(when (org-remove-latex-fragment-image-overlays beg end)
+		  (message "LaTeX fragment image removed")
+		  (throw 'exit nil))
+		(setq msg "Creating image..."
 	   (t
 	(org-with-limited-levels
 	 (setq beg (if (org-at-heading-p) (line-beginning-position)
 			 (outline-previous-heading)
-			 (point)))
-	 (setq end (progn (outline-next-heading) (point)))
-	 (if (org-remove-latex-fragment-image-overlays beg end)
-		 (progn
-		   (message "LaTeX fragment images removed from section")
-		   (throw 'exit nil))
-	   (setq msg "Creating images for section...")
+			 (point))
+		   end (progn (outline-next-heading) (point)))
+	 (when (org-remove-latex-fragment-image-overlays beg end)
+	   (message "LaTeX fragment images removed from section"))
+	   (setq msg "Creating images for section..."
 	  (let ((file (buffer-file-name (buffer-base-buffer
 	(org-format-latex
 	 (concat org-preview-latex-image-directory "org-ltximg")
-- 
2.20.1



Re: [O] Completely hide the :PROPERTIES: drawer in org-mode.

2019-02-13 Thread Marco Wahl


> More generally, I feel uneasy about completely hiding stuff. Org format
> is not meant to be opaque. I think the current situation is fine, as far
> as /core/ Org is concerned. Of course, users are free to extend it to
> their own needs.

Yes, indeed.

Occasionally I use

#v+
#+begin_src elisp
; lexical binding, please!
(let (ols)

  (defun mw-org-hide-meta-heading-info ()
"Hide meta data following headings."
(interactive)
(org-show-all) ; expand all props before make invisible to avoid ellipses.
(save-excursion
  (goto-char (point-min))
  (unless (org-at-heading-p) (outline-next-heading))
  (while (not (eobp))
(let ((beg (1+ (progn (end-of-line) (point
  (end (1- (progn (org-end-of-meta-data t) (point)
  (when (< beg end)
(push (make-overlay beg end) ols)
(overlay-put (car ols) 'invisible t)))
(when (not (org-at-heading-p))
  (outline-next-heading)

  (defun mw-org-show-meta-info-lines ()
"Show meta info."
(interactive)
(mapc #'delete-overlay ols)
(setq ols nil)))
#+end_src
#v-

to completely get the property meta stuff out of sight.


Ciao,
-- 
Marco
GPG: http://pgp.mit.edu/pks/lookup?search=0x49010A040A3AE6F2





[O] org-mode time durations

2019-02-13 Thread Jude DaShiell
I have a column of timestamps and these are more than 24 hours apart and
can't use the ;t format to get durations in a third column when two of
these timestamps are subtracted.  Fortunately, I can handle this
application with some basic programming.



--




Re: [O] org-clock: Custom shortcuts for C-u C-c C-x C-i

2019-02-13 Thread Leo Gaspard
Hi Michaël,

Michaël Cadilhac  writes:
> This is not possible out of the box; can you say a bit more about how
> you expect to indicate which tasks are to be always present?

I would be thinking of something like defining a list of key -> link to
a task (that may be generated with org-id's task ID, [[*foobar]] links
or whatever) in my `init.el`.

> A quick-and-dirty way to implement something along these lines is to
> modify org-clock-history-push to always keep a selected set of markers
> in org-clock-history.

Hmm… That sounds like it'd work, but would have a pretty terrible UX. I
guess I'll go with just using custom shortcuts for now, then, if there's
no easy way to integrate it with C-ucxi. (I don't feel like I'm ready to
dive into too intricate elisp yet)

Thank you for your feedback!
Cheers,
  Leo



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
Ok, let's make this more concrete so I can start working on it then.

Alternative A:

Provide three functions:

org-toggle-latex-fragment:
bound to C-c C-x C-l
has an optional argument arg
delegates to org-preview-latex-section if necessary (outside of
fragment or C-u)

org-preview-latex-section:
unbound
has an optional argument remove

org-preview-latex-all:
unbound
has an optional argument remove



Alternative B:

Do some cosmetic changes to org-toggle-latex-fragment and provide the
following bindings:

C-c C-x C-l: toggle fragment or preview section
C-u C-c C-x C-l: unpreview section
C-u C-u C-c C-x C-l: preview document
C-u C-u C-u C-c C-x C-l: unpreview document
I favor alternative B since it's a simpler change and the only awful
binding is the (by far) less useful one.



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Carlos Pita  writes:

>> C-c C-x C-l: as you defined it
>> C-u C-c C-x C-l: preview document scope.
>> C-- (or C-0) C-c C-x C-l: as you defined C-u C-c C-x C-l.
>> C-- (or C-0) C-u C-c C-x C-l: unpreview document scope.
>
> Btw, I don't think that "preview the entire document" is such a rare
> use case. Consider that you've taken some quick notes using embedded
> latex (I need to do that often because my notes are almost exclusively
> about mathematical stuff and unicode is far from enough). Now you open
> the notes and you can i. export to pdf and preview using
> docview/pdf-tools/external pdf reader or, alternatively, ii. preview
> all fragments. I agree it's more usual to go to some section of
> interest and then preview it, but nevertheless full preview has its
> place.

I don't want to remove the possibility to preview a full document.
However, I prefer not binding it instead of binding it to an awfully
long key sequence. For example, if the function responsible for
previewing the full document is called `org-latex-preview-all', I'm sure
I can fire `M-x org-latex-preview-all RET' at least as fast as `C-0 C-u
C-c C-x C-l'. And if I need it often enough, I could bind it to, e.g.,
`C-c v' and be done with it.

> This proposal makes more cumbersome to unpreview the entire document,
> which I do think is barely necessary. But the other use cases are just
> one modifier away from the base use case (toggle fragment). The
> downside is that C-0 is assigned to an arguably less frequent use case
> than C-u, because of the mnemonic argument. As I said, I dislike
> swapping them, but if you prefer it that way I'm fine with it; in that
> case what will result is your proposal plus two C-0 or something
> variations for full document.

Even if C-0 or C-- are good mnemonics, C-u is, in addition to being
easier to type, the universal argument. For any given binding `B', one
can reasonably expect to find the most usual alternative action bound to
`C-u B'. Here, clearing previewing is much more useful than previewing
the whole document. As a user, I would rather expect it under `C-u C-c
C-x C-l`.

On the implementation side, all previewing functions are just a wrapper
away from `org-format-latex'. For example:

(defun org--latex-preview-region (beg end)
  "Preview LaTeX fragments between BEG and END."
  (let ((file (buffer-file-name (buffer-base-buffer
(org-format-latex
 (concat org-preview-latex-image-directory "org-ltximg")
 beg end
 ;; Emacs cannot overlay images from remote hosts.  Create
 ;; it in `temporary-file-directory' instead.
 (if (or (not file) (file-remote-p file))
 temporary-file-directory
   default-directory)
 'overlays nil 'forbuffer org-preview-latex-default-process)))

(defun org-latex-preview-all ( arg)
  "Preview all LaTeX fragments throughout the document.
When optional argument ARG is non-nil, remove previews instead."
  (if arg (org-remove-latex-fragment-image-overlays)
(org--latex-preview-region (point-min) (point-max

We can then re-use `org--latex-preview-region' for previewing a section,
or only the LaTeX fragment at point.



Re: [O] Completely hide the :PROPERTIES: drawer in org-mode.

2019-02-13 Thread Nicolas Goaziou
Michaël Cadilhac  writes:

> You mention that these drawers don't clutter display, so as an
> example, consider the following screenshot:
>   https://michael.cadilhac.name/public/org-props.png

The face you use for drawers is, well obnoxious, to say the least. No
wonder you find them cluttering your display.

> All the property drawers in that screenshot consist of "ID" elements
> added by ox-icalendar.  Arguably, these properties are internal values
> and their storage shouldn't interfere with the user's experience.

These are not internal values only. You can use them as link targets,
too.

> But I do understand being uneasy about hiding stuff.   Another
> solution that would work for me would be to change the font size and
> color a folded :PROPERTIES: drawer, and have a normal font when I open
> the drawer.  Is there a way to do that?

I don't think that's possible out of the box, but font-lock stuff is
configurable.

> I thought I could start playing with the face "org-drawer" but it
> looks unused.  Any help?

It seems that, for some reason, drawers use `org-special-keyword'. It
sounds like a bug.



Re: [O] Completely hide the :PROPERTIES: drawer in org-mode.

2019-02-13 Thread Michaël Cadilhac
On Wed, 13 Feb 2019 at 14:32, Nicolas Goaziou  wrote:

> Since properties drawers are almost exclusively folded, I don't think
> incriminated properties clutter display. Besides, I don't think any
> property is irrelevant to every user. How would we know?

I'd have a customizable list of unimportant/internal properties, and
if a property drawer only contains these properties, it is hidden.

You mention that these drawers don't clutter display, so as an
example, consider the following screenshot:
  https://michael.cadilhac.name/public/org-props.png
All the property drawers in that screenshot consist of "ID" elements
added by ox-icalendar.  Arguably, these properties are internal values
and their storage shouldn't interfere with the user's experience.

But I do understand being uneasy about hiding stuff.   Another
solution that would work for me would be to change the font size and
color a folded :PROPERTIES: drawer, and have a normal font when I open
the drawer.  Is there a way to do that?
I thought I could start playing with the face "org-drawer" but it
looks unused.  Any help?

Thanks!

Cheers;
M.



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
> C-c C-x C-l: as you defined it
> C-u C-c C-x C-l: preview document scope.
> C-- (or C-0) C-c C-x C-l: as you defined C-u C-c C-x C-l.
> C-- (or C-0) C-u C-c C-x C-l: unpreview document scope.

Btw, I don't think that "preview the entire document" is such a rare
use case. Consider that you've taken some quick notes using embedded
latex (I need to do that often because my notes are almost exclusively
about mathematical stuff and unicode is far from enough). Now you open
the notes and you can i. export to pdf and preview using
docview/pdf-tools/external pdf reader or, alternatively, ii. preview
all fragments. I agree it's more usual to go to some section of
interest and then preview it, but nevertheless full preview has its
place.

This proposal makes more cumbersome to unpreview the entire document,
which I do think is barely necessary. But the other use cases are just
one modifier away from the base use case (toggle fragment). The
downside is that C-0 is assigned to an arguably less frequent use case
than C-u, because of the mnemonic argument. As I said, I dislike
swapping them, but if you prefer it that way I'm fine with it; in that
case what will result is your proposal plus two C-0 or something
variations for full document.



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Carlos Pita
> WDYT?

I like it. Indeed, I was tempted to suggest removing document scope
but, as an end user, I moderate my proposals to be more or less
conservative.

There are some complications though. If we remove the document scope
bindings we have to refactor the current function quite a bit, because
the interface it provides is purely interactive relying on numerical
arguments. Maybe a split would be in order. I don't like this aspect
that much.

What do you think of this variation of your last proposal:

C-c C-x C-l: as you defined it
C-u C-c C-x C-l: preview document scope.
C-- (or C-0) C-c C-x C-l: as you defined C-u C-c C-x C-l.
C-- (or C-0) C-u C-c C-x C-l: unpreview document scope.

Here I'm keeping both of your bindings although C-u is changed to C--
(or C-0, I think both are good mnemonics - = remove, 0 = leave zero).
Then C-u is free to be used to signal document scope. I dislike the
idea of swapping the roles of this modifiers because of the mnemonic
advantage, even if "clearing previews" is to be used more often than
"document scope".

If you prefer to keep just your two bindings instead, we need to
discuss how to offer the "document scope" interface to the end user.

Best regards
--
Carlos



Re: [O] Completely hide the :PROPERTIES: drawer in org-mode.

2019-02-13 Thread Nicolas Goaziou
Hello,

Michaël Cadilhac  writes:

> Agreed, hiding properties entirely seems overkill and quite limited in
> use cases.  However, I think this stems from a more general need to
> hide properties that are irrelevant to the user—for instance, UIDs
> created by ox-icalendar, or other internal properties.  As a user, I
> see no need whatsoever to see—let alone edit—such a property, and feel
> that it clutters the display.  Assuming that properties are edited
> using the suitable commands, no clash would be created by having a set
> P of properties such that drawers with only P-properties would be
> hidden.  What do you think?

Since properties drawers are almost exclusively folded, I don't think
incriminated properties clutter display. Besides, I don't think any
property is irrelevant to every user. How would we know?

More generally, I feel uneasy about completely hiding stuff. Org format
is not meant to be opaque. I think the current situation is fine, as far
as /core/ Org is concerned. Of course, users are free to extend it to
their own needs.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: org-toggle-latex-fragment doesn't work as documented [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Hello,

Carlos Pita  writes:

> So lets play with minus as a modifier, I like that idea.
>
> (A) Here is a variation of my proposal:
>
> [C- -] [C-u] [C-u] C-c C-x C-l
>
> The modifier [C- -] means force preview.
> The modifier [C-u] means section scope.
> The modifier [C-u][C-u] means document scope.
>
> So - means force, C-u means section, C-u C-u means document.
>
> One advantage of this approach is backwards compatibility.
>
> (B) Here is a variation of your proposal. In it - means clear (I find
> this a good mnemonic since "minus removes stuff"):
>
> - C-c C-x C-l :: Toggle preview on the fragment at point, raise an
> error outside a fragment
> - C-u C-c C-x C-l :: *Preview* for current section
> - C-- C-u C-c C-x C-l :: *Clear preview* from the current section
> - C-u C-u C-c C-x C-l :: *Preview* the whole document
> - C-- C-u C-u C-c C-x C-l :: *Clear preview* for the whole document
>
> So - means clear, C-u means section, C-u C-u means document.

This is daunting. 

I have another, simpler, suggestion. First, we can drop document scope
altogether. We may still provide a command for it, but binding it seems
not useful. Also, if we keep the "smart" behaviour of `C-c C-x C-l', we
can also get rid of section scope. This leaves plenty of space to
distinguish between previewing and clearing previews.

Concretely

- `C-c C-x C-l' :: When on a LaTeX fragment, toggle previewing, as
  usual. Outside of LaTeX fragment, preview the whole section,
  unconditionally. In particular, if there is nothing (more) to preview,
  do nothing.

- `C-u C-c C-x C-l' :: Clear all previews in the current section,
  unconditionally.

There is no overlap, clearing previews is still fast, and you can
preview LaTeX fragments incrementally.

If we absolutely need to bind document preview, we can still keep it
bound in `C-u 0 C-c C-x C-l' (`C-u - C-c C-x C-l' to clear), but it
doesn't need a binding out of the box.

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: org-publish error on i386 [9.2.1 (9.2.1-8-g1b1797-elpa @ /Users/andrew/.emacs.d/elpa/org-20190211/)]

2019-02-13 Thread Nicolas Goaziou
Hello,

Josiah Schwab  writes:

> See discussion at
> https://lists.gnu.org/archive/html/emacs-devel/2019-02/msg00238.html
>
> Sounds like it was fixed in master, but maybe not in maint.

Since the fix is innocuous, I just backported it to maint, too.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: org-publish error on i386 [9.2.1 (9.2.1-8-g1b1797-elpa @ /Users/andrew/.emacs.d/elpa/org-20190211/)]

2019-02-13 Thread Josiah Schwab
See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2019-02/msg00238.html

Sounds like it was fixed in master, but maybe not in maint.

Josiah



[O] Bug: org-publish error on i386 [9.2.1 (9.2.1-8-g1b1797-elpa @ /Users/andrew/.emacs.d/elpa/org-20190211/)]

2019-02-13 Thread Andrew Eggenberger
I tried to publish a project on Emacs 25.2.1 and received an arithmetic
out of range error on a call to floor.  The problem seems to be a call
to floor during the caching process that's out of the 32-bit integer range. 
Backtrace follows:

Debugger entered--Lisp error: (range-error "floor" 1549920598.0)
  floor(1549920598.0)
  org-publish-cache-ctime-of-src()
  org-publish-cache-file-needs-publishing( 
"~/Sites/graphic-pages-production/site/" org-html-publish-to-html 
"~/Documents/org-mode/graphic-issue-planner/")
  org-publish-needed-p( "~/Sites/graphic-pages-production/site/" 
org-html-publish-to-html "~/Sites/graphic-pages-production/site/" 
"~/Documents/org-mode/graphic-issue-planner/")
  org-publish-file( ("graphic-issue-planner" :base-directory 
"~/Documents/org-mode/graphic-issue-planner/" :publishing-directory 
"~/Sites/graphic-pages-production/site/" :publishing-function 
org-html-publish-to-html :archived-trees nil :with-toc nil :recursive nil 
:headline-levels 1) t)
  org-publish-projects((("graphic-issue-planner" :base-directory 
"~/Documents/org-mode/graphic-issue-planner/" :publishing-directory 
"~/Sites/graphic-pages-production/site/" :publishing-function 
org-html-publish-to-html :archived-trees nil :with-toc nil :recursive nil 
:headline-levels 1)))
  org-publish("graphic-issue-planner")

Emacs  : GNU Emacs 25.2.1 (i686-apple-darwin, NS appkit-1038.36 Version 10.6.8 
(Build 10K549))
of 2017-04-21
Package: Org mode version 9.2.1 (9.2.1-8-g1b1797-elpa @ 
~/.emacs.d/elpa/org-20190211/)


Andrew Eggenberger
Editor
Lake City Graphic

office: 651-345-3316 | cell: 612-840-1578 | Twitter: @andrewlcgraphic















Re: [O] org-clock: Custom shortcuts for C-u C-c C-x C-i

2019-02-13 Thread Michaël Cadilhac
Hi there Leo;

This is not possible out of the box; can you say a bit more about how
you expect to indicate which tasks are to be always present?

A quick-and-dirty way to implement something along these lines is to
modify org-clock-history-push to always keep a selected set of markers
in org-clock-history.

Cheers;
M.

On Mon, 11 Feb 2019 at 16:32, Leo Gaspard  wrote:
>
> Hello,
>
> When I run C-u C-c C-x C-i I get a choice between the interrupted task,
> the current task, the default task and recent tasks.
>
> I however wonder whether it's possible to add in custom shortcuts to
> fixed tasks? This would help me easily clock into my “IRC”, “Mails”
> etc. tasks, to and from which I frequently switch.
>
> Do you have any idea how to accomplish that? I haven't been able to find
> anything in the manual [1].
>
> [1] https://orgmode.org/org.html#Clocking-commands
>
> Cheers, and thank you once again for this great piece of software!
>   Leo
>



Re: [O] Bug: latex blocks preview inline [9.2.1 (release_9.2.1-217-g232160 )]

2019-02-13 Thread Carlos Pita
Also, make sure imagemagick is installed.

Btw, you might find this useful for previewing babel-generated images:

(defun my-org-babel-redisplay-images ()
  (when org-inline-image-overlays
(org-redisplay-inline-images)))
(add-hook 'org-babel-after-execute-hook
  #'my-org-babel-redisplay-images)

This reloads the previewed images each time they potentially change.



Re: [O] Bug: latex blocks preview inline [9.2.1 (release_9.2.1-217-g232160 )]

2019-02-13 Thread Carlos Pita
Hi,

>   #+HEADER: :file latex.svg
>   #+HEADER: :results drawer
>   #+BEGIN_SRC latex

I think you're missing some headers to get it working. For example, I
use the following defaults to preview/export images generated with
tikz to html/markdown documents:

  org-babel-default-header-args:latex '((:results . "file raw")
(:exports . "results")
(:cache . "yes")
(:headers . ("\\usepackage{tikz}"))
(:imagemagick . "yes")
(:fit . "yes")))

Try adding them to you src block or to you config. :cache and :fit
aren't necessary for your goal but desirable anyway. The others I
think you will need them.

Of course, if you're embedding your tikz environment in a document
exported to latex, simply embed the fragment (that is, without the src
block) and preview it with C-c C-x C-l.

> When using the org-plus-contrib package from the org archive
> (9.2.1-8-g1b1797-elpaplus),

I don't know what is this, but could it be shipped with different
babel defaults?

Best regards
--
Carlos



Re: [O] Bug: Bad alignment of grouped tags in fast selection dialog [9.2.1 (release_9.2.1-60-gb0379f @ /home/carlos/local/stow/emacs/share/emacs/site-lisp/org/)]

2019-02-13 Thread Nicolas Goaziou
Hello,

Carlos Pita  writes:

> Not a big deal, but here is a slightly better fix that avoids adding
> some spaces before the closing }.
>
> The difference wrt to the previous one is just:
>
> -   (unless (memq (caar tbl) '(:endgroup :endgrouptag)) (insert "\n"))
> -   (when (or ingroup intaggroup) (insert "  "))
> +   (unless (memq (caar tbl) '(:endgroup :endgrouptag))
> + (insert "\n")
> + (when (or ingroup intaggroup) (insert "  ")))
>
> That is, the when clause is inside the unless clause.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Bug: latex blocks preview inline [9.2.1 (release_9.2.1-217-g232160 )]

2019-02-13 Thread Joao Cortes


Consider this latex source block, 

  #+HEADER: :file latex.svg
  #+HEADER: :results drawer
  #+BEGIN_SRC latex 
\begin{tikzpicture}
  \draw[red] (0,0) circle (1cm);
\end{tikzpicture}
  #+END_SRC

I would like to preview the result inline using
org-toggle-inline-images.

When using the latest release from https://code.orgmode.org/bzg/org-mode
(9.2.1-217-g232160), the result is

  #+RESULTS:
  :results:
  :end:


When using the org-plus-contrib package from the org archive
(9.2.1-8-g1b1797-elpaplus),

  #+RESULTS:
  :results:
  [[file:latex.svg]]
  :end:
  
I was expecting to get the second result with both installations as it
seems to be the intended behaviour.

Is there any way to tweak the latest release (from
https://code.orgmode.org/bzg/org-mode) to get the second output?

Thanks
Joao






Emacs  : GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.23.2)
 of 2018-08-13
Package: Org mode version 9.2.1 (release_9.2.1-217-g232160 @ 
/home/joaooneillcortes/.emacs.d/org-mode/lisp/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-mode-hook '(#[0 "\301\211.\207" [imenu-create-index-function 
org-imenu-get-tree] 2]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-all append local] 
5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all 
append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300.\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '(("\\.pdf\\'" lambda (file link) (org-pdfview-open link)) 
(auto-mode . emacs)
 ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) 
("\\.pdf\\'" . default))
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-babel-load-languages '((latex . t) (python . t) (shell . t) (gnuplot . t) 
(C . t) (R . t)
(ruby . t))
 org-ascii-format-drawer-function #[771 ".\207" [] 4 "\n\n(fn NAME CONTENTS 
WIDTH)"]
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-dynamic-block-alist '(("columnview" . org-columns-insert-dblock)
   ("clocktable" . org-clock-report))
 org-babel-tangle-lang-exts '(("ruby" . "rb") ("D" . "d") ("C++" . "cpp") 
("python" . "py")
  ("latex" . "tex") ("emacs-lisp" . "el") ("elisp" 
. "el"))
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("id" :follow org-id-open)
   ("pdfview" :follow org-pdfview-open :complete 
org-pdfview-complete-link
:store org-pdfview-store-link)
   ("bookmark-other-win" :follow bookmark-jump-other-window 
:export nil)
   ("bookmark" :follow bookmark-jump :export nil)
   ("eww" :follow eww :store org-eww-store-link)
   ("rmail" :follow org-rmail-open :store 
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link 
:export org-irc-export)
   ("info" :follow org-info-open :export org-info-export 
:store
org-info-store-link)
   ("gnus" :follow org-gnus-open :store org-gnus-store-link)
   ("docview" :follow org-docview-open :export 
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store 
org-bibtex-store-link)
 

Re: [O] Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]

2019-02-13 Thread Allen Li
Apologies for the spam.

On Wed, Feb 13, 2019 at 9:11 AM Allen Li  wrote:
> I don't see an easy good fix due to how Emacs's dynamic variable
> binding works with respect to buffer local variables.
>
> One way to fix is redefine:
>
> (defun org-let (list  body)
>   (eval `(with-temp-buffer ,(cons 'let (cons list body)

This does not work for obvious reasons, please don't use it.  I'll
shut up now since I clearly need sleep.

>
> That way, the let doesn't use the buffer local value for ocf, so the
> kill-all-local-variables doesn't wipe it.
>
> I can confirm that this fixes this bug.  However, I have no idea what
> effect this may have on all of Org mode.



Re: [O] Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]

2019-02-13 Thread Allen Li
On Wed, Feb 13, 2019 at 8:37 AM Allen Li  wrote:
>
> I'm suspicious of org-agenda-mode -> kill-all-local-variables=
>
> One oddity is that repeatedly reverting the buffer swaps between the
> "correct" overriding column format and the default.

It seems like what is happening is that the org-agenda-prepare and
org-agenda-finalize calls in org-tags-view are swapping
org-agenda-overriding-columns-format (ocf) on and off.  I added debug
messages around these points, and a cycle looks like:

@@@ before prepare "%TODO %60ITEM %SCHEDULED"
@@@ after prepare "%TODO %60ITEM %SCHEDULED"
@@@ before finalize "%TODO %60ITEM %SCHEDULED"
@@@ after finalize "%TODO %60ITEM %SCHEDULED"
@@@ before prepare "%TODO %60ITEM %SCHEDULED"
@@@ after prepare nil
@@@ before finalize nil
@@@ after finalize nil

During the first cycle, prepare doesn't unset the local value for ocf
because it's not set, then in finalize the local value of ocf is set
using the current dynamic value.

During the second cycle, ocf is set locally so prepare wipes the local
value.  It looks like this also wipes the current let-bound dynamic
value for ocf, so during finalize ocf is not (re)set as a local value.

Go back to first cycle.

I don't see an easy good fix due to how Emacs's dynamic variable
binding works with respect to buffer local variables.

One way to fix is redefine:

(defun org-let (list  body)
  (eval `(with-temp-buffer ,(cons 'let (cons list body)

That way, the let doesn't use the buffer local value for ocf, so the
kill-all-local-variables doesn't wipe it.

I can confirm that this fixes this bug.  However, I have no idea what
effect this may have on all of Org mode.



Re: [O] Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]

2019-02-13 Thread Allen Li
On Wed, Feb 13, 2019 at 8:17 AM Allen Li  wrote:
>
> 0. Make /tmp/tmp.org containing
>
> * TODO foo bar
>
> 1. emacs -Q
> 2. Eval (setq org-agenda-custom-commands '(("n" "n" alltodo "" 
> ((org-agenda-overriding-columns-format "%TODO")
> 3. Eval (setq org-agenda-files '("/tmp/tmp.org"))
> 4. M-x org-agenda RET n
> 5. Move point to item
> 6. C-c C-x C-c (column view)
> 7. g
>
> Expected:
>
> Column format is preserved
>
> Actual:
>
> Column format is reset
>
> (The example uses the version of Org shipped with Emacs, but I can
> reproduce with my personal config using latest org-contrib-plus)

I'm suspicious of org-agenda-mode -> kill-all-local-variables

Debugger entered--killing local value of
org-agenda-overriding-columns-format in buffer *Org
Agenda(f:SCHEDULED>"")*:
  debug--implement-debug-watch(org-agenda-overriding-columns-format
nil makunbound #"")*>)
  kill-all-local-variables()
  org-agenda-mode()
  org-agenda-prepare("TAGS SCHEDULED>\"\"")
  org-tags-view((4) "SCHEDULED>\"\"")
  (let ((org-agenda-sorting-strategy '(scheduled-up))
(org-agenda-overriding-columns-format "%TODO %60ITEM %SCHEDULED"))
(org-tags-view '(4) (if current-prefix-arg nil
"SCHEDULED>\"\"")))
  eval((let ((org-agenda-sorting-strategy '(scheduled-up))
(org-agenda-overriding-columns-format "%TODO %60ITEM %SCHEDULED"))
(org-tags-view '(4) (if current-prefix-arg nil
"SCHEDULED>\"\""
  org-let(((org-agenda-sorting-strategy '(scheduled-up))
(org-agenda-overriding-columns-format "%TODO %60ITEM %SCHEDULED"))
(org-tags-view '(4) (if current-prefix-arg nil
"SCHEDULED>\"\"")))
  (if series-redo-cmd (eval series-redo-cmd) (org-let lprops redo-cmd))
  (let* ((p (or (and (looking-at "\\'") (1- (point))) (point))) (cpa
(if (eq all t) nil current-prefix-arg)) (org-agenda-doing-sticky-redo
org-agenda-sticky) (org-agenda-sticky nil) (org-agenda-buffer-name (or
org-agenda-this-buffer-name org-agenda-buffer-name))
(org-agenda-keep-modes t) (tag-filter org-agenda-tag-filter)
(tag-preset (get 'org-agenda-tag-filter :preset-filter))
(top-hl-filter org-agenda-top-headline-filter) (cat-filter
org-agenda-category-filter) (cat-preset (get
'org-agenda-category-filter :preset-filter)) (re-filter
org-agenda-regexp-filter) (re-preset (get 'org-agenda-regexp-filter
:preset-filter)) (effort-filter org-agenda-effort-filter)
(effort-preset (get 'org-agenda-effort-filter :preset-filter))
(org-agenda-tag-filter-while-redo (or tag-filter tag-preset)) (cols
org-agenda-columns-active) (line (org-current-line)) (window-line (-
line (org-current-line (window-start (lprops (get
'org-agenda-redo-command 'org-lprops)) (redo-cmd (get-text-property p
'org-redo-cmd)) (last-args (get-text-property p 'org-last-args))
(org-agenda-overriding-cmd (get-text-property p 'org-series-cmd))
(org-agenda-overriding-cmd-arguments (if (eq all t) nil (cond ((listp
last-args) (cons (or cpa (car last-args)) (cdr last-args))) ((stringp
last-args) last-args (series-redo-cmd (get-text-property p
'org-series-redo-cmd))) (put 'org-agenda-tag-filter :preset-filter
nil) (put 'org-agenda-category-filter :preset-filter nil) (put
'org-agenda-regexp-filter :preset-filter nil) (put
'org-agenda-effort-filter :preset-filter nil) (and cols
(org-columns-quit)) (message "Rebuilding agenda buffer...") (if
series-redo-cmd (eval series-redo-cmd) (org-let lprops redo-cmd))
(setq org-agenda-undo-list nil org-agenda-pending-undo-list nil
org-agenda-tag-filter tag-filter org-agenda-category-filter cat-filter
org-agenda-regexp-filter re-filter org-agenda-effort-filter
effort-filter org-agenda-top-headline-filter top-hl-filter) (message
"Rebuilding agenda buffer...done") (put 'org-agenda-tag-filter
:preset-filter tag-preset) (put 'org-agenda-category-filter
:preset-filter cat-preset) (put 'org-agenda-regexp-filter
:preset-filter re-preset) (put 'org-agenda-effort-filter
:preset-filter effort-preset) (let ((tag (or tag-filter tag-preset))
(cat (or cat-filter cat-preset)) (effort (or effort-filter
effort-preset)) (re (or re-filter re-preset))) (if tag (progn
(org-agenda-filter-apply tag 'tag t))) (if cat (progn
(org-agenda-filter-apply cat 'category))) (if effort (progn
(org-agenda-filter-apply effort 'effort))) (if re (progn
(org-agenda-filter-apply re 'regexp (and top-hl-filter
(org-agenda-filter-top-headline-apply top-hl-filter)) (and cols
(called-interactively-p 'any) (org-agenda-columns)) (org-goto-line
line) (recenter window-line))
  org-agenda-redo()

One oddity is that repeatedly reverting the buffer swaps between the
"correct" overriding column format and the default.



[O] Bug: org-agenda-overriding-columns-format destroyed on revert [9.2.1 (9.2.1-2-gc6d37c-elpaplus)]

2019-02-13 Thread Allen Li
0. Make /tmp/tmp.org containing

* TODO foo bar

1. emacs -Q
2. Eval (setq org-agenda-custom-commands '(("n" "n" alltodo "" 
((org-agenda-overriding-columns-format "%TODO")
3. Eval (setq org-agenda-files '("/tmp/tmp.org"))
4. M-x org-agenda RET n
5. Move point to item
6. C-c C-x C-c (column view)
7. g

Expected:

Column format is preserved

Actual:

Column format is reset

(The example uses the version of Org shipped with Emacs, but I can
reproduce with my personal config using latest org-contrib-plus)

Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05
Package: Org mode version 9.2.1 (9.2.1-2-gc6d37c-elpaplus @ 
/home/ionasal/.emacs.d/elpa/org-plus-contrib-20190204/)