Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Adam Porter
Mikhail Skorzhinskii  writes:

> Adam Porter  writes:
>  > However, the org-ql-block version runs in about 1/5th the time (0.7
>  > seconds compared to 3.45 seconds on my collection of org-agenda-files).
>
> For some reason I thought that on average org-ql package is working
> slower then native org-agenda searches. Probably because there are more
> control and interface is much more simpler and cleaner and nothing
> comes free of charge. That sort of thing. :-)

Well, it might also be because it used to be generally slower, and I
tried to be clear about that whenever I mentioned it.  :)  But I've
applied a lot of optimizations to it over the past few months, so it's
generally pretty fast now, sometimes much faster.  It's hard to make a
direct comparison in some cases, depending on the complexity of the
query.  I plan to continue optimizing it as I'm able, so hopefully it
will continue improving.

> I am really glad that I was mistaken. Care to drop a few thoughts on why
> this is the case? This is applicable only for ql-block or other org-ql
> functions are a bit faster too?

Well, it's a completely different implementation.  It has two main
features which attempt to make it fast: it uses regexp searches across
buffers as much as possible, similar to org-agenda.el but in a more
flexible way (though there's still room for improvement here, especially
with complex queries); and it caches results keyed on the query, buffer,
and narrowing (cached results are discarded when a buffer is modified),
which avoids re-running the same queries for unmodified buffers.  Oh,
and it also byte-compiles query predicates and action functions to eke
out a bit more speed.

And in general, I run benchmarks and try to improve performance when
possible; you can see some of the benchmark results in the notes.org
file in the repo (not all of which are up-to-date with current org-ql
code).

org-ql-block is just a way to make use of the results returned by org-ql
queries; other ways include org-ql-agenda, org-ql-search, and of course
you can use the raw results however you like, including calling whatever
:action function you like at matching entries, to return whatever kind
of data you need, or even perform actions directly on entries.

In other words, the querying code is separate from the display-related
code, so all org-ql-block, org-ql-agenda, org-ql-search, etc. do is
format results from org-ql queries and display them.

Upcoming features include an org-ql-sparse-tree command, like
org-sparse-tree but using org-ql queries; recursive queries; and
probably a timeline view like I recently posted about.

Please let me know if you have any feedback!




Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Adam Porter
Samuel Wales  writes:

> the idea was that we can resurrect the timeline view, for all agenda
> files instead of only one, merely by a use of a text search custom
> agenda view.  timestamps go where categories currently go.  sorted by
> that ts.
>
> if an entry has more than one ts (active bare, inactive bare including
> on header, or planning -- other stuff requires org support), then it
> will get more than one agenda line.
>
> so this requires modifying that list that is there for the user to
> modify tasks before displaying them.
>
> can any of this stuff do that?
>
> i keep wanting this feature: do a text search and have all matching
> org-agenda-files outline entries show, with more than one agenda line
> if more than one ts in entry, sorted by that ts.
>
> so for example you search for "melatonin" (or even "." meaning all
> entries, such as for an agenda restriction) and then you get to see
> the most recent thing you did for melatonin or in that restriction at
> the top.  and everything else you did below.  (assuming reverse sort.)
>
> i can post more accurate and precise details if needed, but i wanted
> to know if you think your work can support this.

I don't recall using the timeline view much, so I'm not very familiar
with it.  From your description, it's certainly possible to do that with
a bit of code.  Basically, it would work like this:

1.  Run an org-ql query to find entries which have the type of timestamp
you're looking for, with or without any date/time bounds, and with or
without any additional query parameters.  So the query could be as
simple as, e.g. (ts) or (ts-active), or it could be something like:

(and "melatonin" (ts :from -60))

Which would select all entries mentioning "melatonin" which have any
kind of timestamp within the last 60 days.

2.  The :action argument to org-ql would be a function which returns a
list containing the necessary heading information (e.g. heading text,
marker, etc.) and all timestamps found in the entry.  Something like:

(lambda ()
  (list (point-marker) (org-get-heading)
(cl-loop with limit = (org-entry-end-position)
 while (re-search-forward org-ts-regexp-both
  limit t)
 collect (match-string 0

3.  The results of the query would be a list of lists returned by the
:action function.  Then, you can do whatever you like with that.  It
wouldn't take much code to insert entries into a buffer with each
heading on a line and its timestamps on following lines.

...

Here's a quick prototype.  Note that the timestamps aren't propertized,
so to jump to an entry, you must use the heading; and I didn't bother to
format the timestamps like Org does; and the "date" sorting actually
sorts by the planning line at the moment, rather than other timestamps;
but things like that can easily be polished.

Note that despite my mangling it, Gnus is probably going to wrap these
lines, making the code very ugly, and I can't quickly find how to stop
that, so you might want to use e.g. lispy to reformat it.

(cl-defun org-ql-timeline (buffers-files query)
  (let ((results
 (org-ql-select buffers-files
   query :action
   (lambda ()
 (let* ((heading-string
 (->> (org-element-headline-parser
   (line-end-position))
  org-ql--add-markers
  org-ql-agenda--format-element))
(timestamps
 (cl-loop with limit = (org-entry-end-position)
  while (re-search-forward org-ts-regexp-both
   limit t)
  collect (ts-parse-org (match-string 0
(timestamp-strings
 (->> timestamps
  (-sort #'ts<)
  (--map (concat "" (ts-format it))
   (s-join "\n" (cons heading-string timestamp-strings
   :sort '(date
(org-ql-agenda--agenda nil nil :strings results)))

Use it like this:

  (org-ql-timeline (org-agenda-files)
   '(and "Emacs" (ts)))

That produces a view like this:

  WAITING [#C] org-link-match struct and functions  344d ago :current:Emacs:
2018-09-13 05:54:00 -0500
2018-09-20 00:00:00 -0500
  NEXT Emacs timers and frames  348d ago :current:Emacs:
2018-06-11 08:41:00 -0500
2018-06-14 20:34:00 -0500
2018-09-16 00:00:00 -0500
  WAITING [#B] Emacs ~-defun~ macro idea  4d ago :current:Emacs:
2018-07-10 17:20:00 -0500
2019-08-26 00:00:00 -0500

So, a timeline view isn't currently implemented, but as you can see,
it can easily be done using org-ql.  Thanks for mentioning this; I'll
probably add it in a future version.

> also, does it support all the usual variables for leaders and faces and so on?

I'm 

Re: [O] org-megaup

2019-08-30 Thread Jean-Christophe Helary


> On Aug 31, 2019, at 4:42, Nick Dokos  wrote:
> 
> Jean-Christophe Helary  writes:
> 
>> When I use org-megaup I get a "Invalid function:
>> org-preserve-local-variables" is there a way to fix that ?
>> 
> 
> org-megaup is not defined AFAICT - do you mean `org-metaup'?

Yes, thank you. I'll check everything you wrote this we.

Jean-Christophe

> If not, disregard the rest of this message.
> 
> If yes, I don't see any problems, so you might want to provide the
> context (e.g. are trying to move subtrees up, move table rows up or
> move items in a list up?) Check also the value of `org-metaup-hook' to
> see if something weird crept in there.
> 
> If it happens regardless of context, I would edebug the org-metaup
> function and see where the error message comes from - BTW,
> org-preserve-local-variables is a macro, not a function (so that might
> have something to do with it), defined in org-macs.el. If your setup
> is curdled, that might not be loaded, so try `(load-library org-macs)`
> and see if that resolves if: if it does, then you have to figure out
> whether there is something wrong with your setup (if it doesn't load
> that file automatically) or how it got curdled (if it does).
> 
> -- 
> Nick
> 
> "There are only two hard problems in computer science: cache
> invalidation, naming things, and off-by-one errors." -Martin Fowler

Jean-Christophe Helary
---
http://mac4translators.blogspot.com @brandelune




Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Tim Cross


To be a little precise, Org mode PDF documents created using the default
Latex classes are not going to meet minimal accessibility standards. The
extent to which they can be accessed using accessibility software will
depend largely on the structure of the underlying PDF. I have not
investigated other workflows for generating PDFs from org (for example,
what happens if you go to some other intermediate format, like HTML or
markdown etc) and then to PDF using a different tool to generate the
final PDF. Likewise, I don't know if some of the TeX pdf generators are
better than others (this is partly why it gets complicated - there are
multiple workflows to generate PDFs from Latex). There are people
working on additional latex packages to address this accessibility
requirement. However, either they are only at experimental status or
require significant configuration and setup or require the author to
manually add additional data, making them inappropriate for org-mode.

With PDFs, the level of accessibility does depend a lot on the structure
of the underlying document. Even PDFs without full tagging can be
reasonably accessible if the structure of the data in the PDF is
straight-forward i.e. not lots of tables, multi-column, lots
of footnotes and internal references etc. If the data flow in the
document is reasonably 'linear', then it isn't too bad. If the document
has lots of embedded postscript or any image like data, that will not be
accessible and will not be tagged adequately. Likewise, I've found stuff
generated in math mode is typically inaccessible.

The various text extraction tools, like pdftotext are able to extract
the text. However, because it cannot determine the structure with any
accuracy, it can tend to be somewhat jumbled and have a bit of
'garbage'. Again, how good/bad this is depends on the underlying PDF
structure.

You might find the following links useful -

https://www.tug.org/twg/accessibility/

https://tug.org/pipermail/accessibility/2016q4/05.html

You might be able to improve the accessibility of PDFs generated from
Latex by adding some of the (mostly experimental) additional packages to
your Org mode setup. However, this will probably have some unfortunate
side effects or corner cases (which is why I don't just recommend adding
these packages as defaults in org itself).

There has been an item on my todo list to experiment with this stuff for
a long time, but I just never seem to get that far down the list. If you
do find some configurations which help make the PDFs more accessible, I
would be happy to try adding them to my setup for further testing. We
may find some additional packages which improve the situation and don't
have unacceptable impact on general org performance and stability. I'm
confident that if we can demonstrate this, having these additions added
to org-mode defaults would be possible.

Tim

Jude DaShiell  writes:

> Okay, orgmode pdf files will be inaccessible for the foreseeable future.
>  Has anyone had any luck extracting text however mangled from one of
> these with pdftotext or similar tools?  If that's not possible that will
> be another good thing to know.
>
> On Sat, 31 Aug 2019, Tim Cross wrote:
>
>> Date: Fri, 30 Aug 2019 19:31:32
>> From: Tim Cross 
>> To: emacs-orgmode@gnu.org
>> Cc: Nick Dokos 
>> Subject: Re: [O] minimal testing setup for pdf export?
>>
>>
>> I think the main thing which needs to be in the PDF is structure
>> 'tagging'. Unfortunately, making truly accessible PDFs is the one area
>> I've found where the 'TeX suite is weak. I was tracking some discussions
>> about this on  the various TeX and Latex lists and it seems that to add
>> the necessary information needed to create accessible PDFs requires a
>> major redesign of TeX internals.
>>
>> It has been a while since I looked at this, but I do believe there are
>> some add-on latex packages which can help a bit, but creating PDFs which
>> meet minimal accessibility requirement tests is currently not possible.
>>
>> IIRC the speech-disabling feature is not part of the PDF spec. This is
>> somethinhg added by Adobe (along with other DRM support). This is no
>> 'switch' so to speak in plain PDF documents as the PDF spec predates
>> considerations like TTS or even accessibility.
>>
>>
>> Jude DaShiell  writes:
>>
>> > most of the books sold on google play books are speech-disabled by
>> > publishers.  The adobe accessibility site has speech-enabled
>> > accessibility examples.  I think it's a matter of a single control that
>> > is either enabled or disabled.  Oh, the IRS has speech-enabled pdf tax
>> > forms anyone can download.  I nearly forgot about that one.  The 1099R
>> > form is a short one so it ought to be pretty quick to find the setting
>> > in one of those forms.
>> >
>> > On Fri, 30 Aug 2019, Nick Dokos wrote:
>> >
>> >> Date: Fri, 30 Aug 2019 16:07:49
>> >> From: Nick Dokos 
>> >> To: emacs-orgmode@gnu.org
>> >> Subject: Re: [O] minimal testing setup for pdf export?
>> 

Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Samuel Wales
thanks, looks gorgeous!  i will file it for a possible future time
when i can run it, diff it with existing agenda to make sure it's the
same for me, and just switch over to it.  (i use 2d and 7d agendas and
text search view with and without inactive.)

i'll ask a couple of questions.

a while back i posted some notes on something that i was going to
implement (but wasn't able to), because somebody asked for it, hoping
that the notes would help him/her.

the idea was that we can resurrect the timeline view, for all agenda
files instead of only one, merely by a use of a text search custom
agenda view.  timestamps go where categories currently go.  sorted by
that ts.

if an entry has more than one ts (active bare, inactive bare including
on header, or planning -- other stuff requires org support), then it
will get more than one agenda line.

so this requires modifying that list that is there for the user to
modify tasks before displaying them.

can any of this stuff do that?

i keep wanting this feature: do a text search and have all matching
org-agenda-files outline entries show, with more than one agenda line
if more than one ts in entry, sorted by that ts.

so for example you search for "melatonin" (or even "." meaning all
entries, such as for an agenda restriction) and then you get to see
the most recent thing you did for melatonin or in that restriction at
the top.  and everything else you did below.  (assuming reverse sort.)

i can post more accurate and precise details if needed, but i wanted
to know if you think your work can support this.

also, does it support all the usual variables for leaders and faces and so on?

it all sounds promising.

more speed and beautiful sexps!  what more could we ask for?  :)


On 8/30/19, Adam Porter  wrote:
> Samuel Wales  writes:
>
>> i have been watching these developments with interest.  i want a
>> faster 2-day agenda, and really like the idea of a lisp syntax for
>> querying, perhaps one that can combine text search with structured.
>>
>> so just so it's known that there is otherwise silent interest.
>> limited in computer use so cannot switch but following.
>
> I appreciate the feedback nonetheless.
>
> A two-day agenda could be done something like this:
>
> (org-ql-agenda (org-agenda-files)
>   (and (or (deadline :from today :to +1)
>(scheduled :from today :to +1)
>(ts-active :from today :to +1))
>(not (done)))
>   :sort (date priority todo)
>   :super-groups ((:auto-planning t)))
>
> To show deadlined entries taking org-deadline-warning-days into account,
> more like the traditional Org Agenda, use (deadline auto), like:
>
> (org-ql-agenda (org-agenda-files)
>   (and (or (deadline auto)
>(scheduled :from today :to +1)
>(ts-active :from today :to +1))
>(not (done)))
>   :sort (date priority todo)
>   :super-groups ((:auto-planning t)))
>
> Grouping by date in this example is done with the org-super-agenda
> :auto-planning selector, which uses the earliest planning timestamp in
> an entry.  So it's not exactly like Org Agenda, but it approximates what
> you're asking for, and org-ql's built-in caching may provide a speedup
> for subsequent calls.
>
> Here's an example that's similar to the Org Agenda's Log Mode:
>
> (org-ql-agenda
>   (or (and (not (done))
>(or (habit)
>(deadline auto)
>(scheduled :to today)
>(ts-active :on today)))
>   (closed :on today))
>   :sort (date priority todo))
>
>
>
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.



Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Jude DaShiell
Okay, orgmode pdf files will be inaccessible for the foreseeable future.
 Has anyone had any luck extracting text however mangled from one of
these with pdftotext or similar tools?  If that's not possible that will
be another good thing to know.

On Sat, 31 Aug 2019, Tim Cross wrote:

> Date: Fri, 30 Aug 2019 19:31:32
> From: Tim Cross 
> To: emacs-orgmode@gnu.org
> Cc: Nick Dokos 
> Subject: Re: [O] minimal testing setup for pdf export?
>
>
> I think the main thing which needs to be in the PDF is structure
> 'tagging'. Unfortunately, making truly accessible PDFs is the one area
> I've found where the 'TeX suite is weak. I was tracking some discussions
> about this on  the various TeX and Latex lists and it seems that to add
> the necessary information needed to create accessible PDFs requires a
> major redesign of TeX internals.
>
> It has been a while since I looked at this, but I do believe there are
> some add-on latex packages which can help a bit, but creating PDFs which
> meet minimal accessibility requirement tests is currently not possible.
>
> IIRC the speech-disabling feature is not part of the PDF spec. This is
> somethinhg added by Adobe (along with other DRM support). This is no
> 'switch' so to speak in plain PDF documents as the PDF spec predates
> considerations like TTS or even accessibility.
>
>
> Jude DaShiell  writes:
>
> > most of the books sold on google play books are speech-disabled by
> > publishers.  The adobe accessibility site has speech-enabled
> > accessibility examples.  I think it's a matter of a single control that
> > is either enabled or disabled.  Oh, the IRS has speech-enabled pdf tax
> > forms anyone can download.  I nearly forgot about that one.  The 1099R
> > form is a short one so it ought to be pretty quick to find the setting
> > in one of those forms.
> >
> > On Fri, 30 Aug 2019, Nick Dokos wrote:
> >
> >> Date: Fri, 30 Aug 2019 16:07:49
> >> From: Nick Dokos 
> >> To: emacs-orgmode@gnu.org
> >> Subject: Re: [O] minimal testing setup for pdf export?
> >>
> >> Jude DaShiell  writes:
> >>
> >> > It would be helpful if when pdf get exported from orgmode they have
> >> > speech enabled by default.
> >> >
> >>
> >> Not sure that org mode can do anything about, since it's LaTeX that 
> >> produces
> >> the PDF. That said, I'm not sure what needs to be done: what's the 
> >> difference
> >> between a speech-enabled PDF and a non-speech-enabled one?
> >>
> >>
>
>
>

-- 




Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Tim Cross


I think the main thing which needs to be in the PDF is structure
'tagging'. Unfortunately, making truly accessible PDFs is the one area
I've found where the 'TeX suite is weak. I was tracking some discussions
about this on  the various TeX and Latex lists and it seems that to add
the necessary information needed to create accessible PDFs requires a
major redesign of TeX internals.

It has been a while since I looked at this, but I do believe there are
some add-on latex packages which can help a bit, but creating PDFs which
meet minimal accessibility requirement tests is currently not possible.

IIRC the speech-disabling feature is not part of the PDF spec. This is
somethinhg added by Adobe (along with other DRM support). This is no
'switch' so to speak in plain PDF documents as the PDF spec predates
considerations like TTS or even accessibility.


Jude DaShiell  writes:

> most of the books sold on google play books are speech-disabled by
> publishers.  The adobe accessibility site has speech-enabled
> accessibility examples.  I think it's a matter of a single control that
> is either enabled or disabled.  Oh, the IRS has speech-enabled pdf tax
> forms anyone can download.  I nearly forgot about that one.  The 1099R
> form is a short one so it ought to be pretty quick to find the setting
> in one of those forms.
>
> On Fri, 30 Aug 2019, Nick Dokos wrote:
>
>> Date: Fri, 30 Aug 2019 16:07:49
>> From: Nick Dokos 
>> To: emacs-orgmode@gnu.org
>> Subject: Re: [O] minimal testing setup for pdf export?
>>
>> Jude DaShiell  writes:
>>
>> > It would be helpful if when pdf get exported from orgmode they have
>> > speech enabled by default.
>> >
>>
>> Not sure that org mode can do anything about, since it's LaTeX that produces
>> the PDF. That said, I'm not sure what needs to be done: what's the difference
>> between a speech-enabled PDF and a non-speech-enabled one?
>>
>>


-- 
Tim Cross



Re: [O] Bug: tangling with elisp as lang in a noweb reference doesn't work [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]

2019-08-30 Thread Nicolas Goaziou
Hello,

immanuel  writes:

> #+NAME: this is a test
> #+BEGIN_SRC elisp :tangle no
>
> (message \"aha\") #+END_SRC
>
> #+BEGIN_SRC elisp :noweb yes :comments noweb :tangle out.el
> first
> <>
> second
> #+END_SRC
>
> #+BEGIN_SRC elisp :tangle no 
> (progn
> (org-babel-tangle)
> (with-temp-buffer
> (insert-file-contents "out.el")
> (buffer-string)
> #+END_SRC
>
>
> Doesn't work. The reason is that the function
> org-babel-expand-noweb-references uses 
>
> #+BEGIN_SRC emacs-lisp
> (c-wrap (lambda (text)
> (with-temp-buffer
> (funcall (intern (concat lang "-mode")))
> ...
> #+END_SRC

Fixed! Thank you for the report and the analysis.

Regards,

-- 
Nicolas Goaziou



Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Jude DaShiell
most of the books sold on google play books are speech-disabled by
publishers.  The adobe accessibility site has speech-enabled
accessibility examples.  I think it's a matter of a single control that
is either enabled or disabled.  Oh, the IRS has speech-enabled pdf tax
forms anyone can download.  I nearly forgot about that one.  The 1099R
form is a short one so it ought to be pretty quick to find the setting
in one of those forms.

On Fri, 30 Aug 2019, Nick Dokos wrote:

> Date: Fri, 30 Aug 2019 16:07:49
> From: Nick Dokos 
> To: emacs-orgmode@gnu.org
> Subject: Re: [O] minimal testing setup for pdf export?
>
> Jude DaShiell  writes:
>
> > It would be helpful if when pdf get exported from orgmode they have
> > speech enabled by default.
> >
>
> Not sure that org mode can do anything about, since it's LaTeX that produces
> the PDF. That said, I'm not sure what needs to be done: what's the difference
> between a speech-enabled PDF and a non-speech-enabled one?
>
>

-- 




[O] Oas: a small addon to Org Mode to automatically close tasks with statistics

2019-08-30 Thread Andrea Giugliano
Hi,

I recently landed on this conversation:
https://lists.gnu.org/archive/html/emacs-orgmode/2010-03/msg00802.html

Since I find myself quite often in a situation like the following:

* TODO abc [3/3]
- [X] a
- [X] b
- [X] c

I decided to dive more into Org's API, and I created this library [0] to
automatically moving that task to DONE. My library checks that when you
are in a situation like:

* TODO abc [1/1]
- [X] a

** TODO b

the parent task does not swap to DONE because there is still a sub-task
to complete.

Tasks that have heading like

* abc [0/1]

or

* TODO abc

do NOT get updated, because I want this to work only for TODO that have
statistics.

How could I propose this as an add-on of Org Mode? Do you think it is
worth the effort?

Any feedback is very welcome to learn more :)

Best,

Andrea

[0] https://github.com/ag91/org-active-statistics



Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Nick Dokos
Jude DaShiell  writes:

> It would be helpful if when pdf get exported from orgmode they have
> speech enabled by default.
>

Not sure that org mode can do anything about, since it's LaTeX that produces
the PDF. That said, I'm not sure what needs to be done: what's the difference
between a speech-enabled PDF and a non-speech-enabled one?

-- 
Nick






Re: [O] org-megaup

2019-08-30 Thread Nick Dokos
Jean-Christophe Helary  writes:

> When I use org-megaup I get a "Invalid function:
> org-preserve-local-variables" is there a way to fix that ?
>

org-megaup is not defined AFAICT - do you mean `org-metaup'?

If not, disregard the rest of this message.

If yes, I don't see any problems, so you might want to provide the
context (e.g. are trying to move subtrees up, move table rows up or
move items in a list up?) Check also the value of `org-metaup-hook' to
see if something weird crept in there.

If it happens regardless of context, I would edebug the org-metaup
function and see where the error message comes from - BTW,
org-preserve-local-variables is a macro, not a function (so that might
have something to do with it), defined in org-macs.el. If your setup
is curdled, that might not be loaded, so try `(load-library org-macs)`
and see if that resolves if: if it does, then you have to figure out
whether there is something wrong with your setup (if it doesn't load
that file automatically) or how it got curdled (if it does).

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[O] org-ref: conditionally add url to formatted citation

2019-08-30 Thread Matt Price
On Sat, Jan 7, 2017 at 8:23 AM John Kitchin  wrote:

> >
> >>
> >> 2. If you click on a citation link, you can select an action to copy the
> >> formatted entry for that key.
> >
> >
> > I had trouble with this. I constructed a minimal emacs config:
> >
> > #+BEGIN_SRC emacs-lisp
> > ;;; elpa interface
> > (setq package-archives ())
> > (add-to-list 'package-archives '("marmalade" . "
> > http://marmalade-repo.org/packages/;))
> > (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/
> "))
> > (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/;) t)
> > (add-to-list 'package-archives '("melpa" . "
> > http://melpa.milkbox.net/packages/;) t)
> > ;; basic initialization, (require) non-ELPA packages, etc.
> > (package-initialize)
> >
> > (require 'cl)
> > (require 'org)
> > (require 'helm-config)
> > (require 'helm)
> > (require 'helm-bibtex)
> >
> > ;; see org-ref for use of these variables
> > (setq org-ref-bibliography-notes "~/Bibliography/notes.org"
> >   org-ref-default-bibliography '("~/Bibliography/Bibliography.bib")
> >   org-ref-pdf-directory "~/Bibliography/files/")
> >
> > (setq bibtex-completion-bibliography "~/Bibliography/Bibliography.bib"
> >   bibtex-completion-library-path "~/Bibliography/files"
> >   )
> >
> > ;; org-define-error
> > ;; for whatever reason, org wasn't finding this
> > (defun org-define-error (name message)
> >   "Define NAME as a new error signal.
> > MESSAGE is a string that will be output to the echo area if such
> > an error is signaled without being caught by a `condition-case'.
> > Implements `define-error' for older emacsen."
> >   (if (fboundp 'define-error) (define-error name message)
> > (put name 'error-conditions
> >  (copy-sequence (cons name (get 'error 'error-conditions))
> >
> > (setq org-ref-formatted-citation-backend "org")
> > (setq org-ref-completion-library 'org-ref-helm-bibtex)
> >
> > (require 'org-ref)
> >
> > #+END_SRC
>
> It is pretty weird about org-define-error. It is in org-compat.el. I am
> using org-9.
>
> > The action proceeds without errors, but nothing seems to be copied ot the
> > clipboard.
> >
> >>
> >> 3. On a bibtex entry, you can use the org-ref-bibtex-hydra/body to copy
> >> a formatted string of the entry.
> >>
> > this works great.  Obviously I need to learn how to use hydra...
>
> I go back and forth on liking ivy/hydra vs helm.
>
> >> You would want to have these settings with a new org-ref:
> >> (setq org-ref-formatted-citation-backend "org")
> >>
> >> (setf (cdr (assoc "book" (cdr (assoc "org"
> >> org-ref-formatted-citation-formats
> >>  "${author} ${year}. /${title}/, ${address}:${publisher}. [[${url}]]")
> >>
> >> Then you can insert the citation and get this (there is no address for
> >> the publisher in my entry). With helm bibtex as the backend, you would
> >> type C-c ], select an entry, and press f8 (or tab and select the insert
> >> formatted action). In the ivy backend, you type M-o f. Both of them
> >> support multiple selections.
> >
> > Yeah, this is awesome, thank you.  it's F7 though, not F8.
>
> could be, the key is related to the number/order of actions in helm-bibtex.
> >>
> >>
> >>
> >> That entry type isn't defined in the formats (there should be a default
> >> entry, but it isn't formatted the way you want), but you could add it
> > like this:
> >>
> >>
> >> (push '("misc" . "${author} ${year}. /${title}/,
> > [[${howpublished}]]")(cdr (assoc "org"
> >> org-ref-formatted-citation-formats)))
> >>
> >
> > got it now.  This is great, thanks.  Moving forward now that you've
> solved
> > my last problem... for properly formatted citations, is latex the only
> > fully supported publication type? What about, say, pandoc md or odt?
> >
> > Thank you thank you thank you!
>
> org-ref has some support to export citations in latex, html, org,
> md/pandoc and text. I do not know how good it is, but the framework for
> it mostly exists.
>
>
>
I rediscovered this thread recently and found it very helpful.  Hope the
necroposting isn't annoying to others.

Using a current org-ref, I was able to  use these hints to make my life
quite a bit easier when writing syllabi.  I'm just inserting formatted
citations for course texts; this is a bit different from most uses of
org-ref. I want the text to be as readable as possible, and to include a
link to the resource if it exists online, or to ignore the url field if it
doesn't exist.  I did this by lightly modifying
~org-ref-formatted-citation-formats~ and then modifying the function
org-ref uses to insert formatted citations:

---
(defun org-ref-format-bibtex-entry (entry)
  "Return a formatted citation for the bibtex entry at point.
Formats are from `org-ref-formatted-citation-formats'. The
variable `org-ref-formatted-citation-backend' determines the set
of format strings used."
  (save-excursion
(bibtex-beginning-of-entry)
(let* ((formats (cdr (assoc org-ref-formatted-citation-backend
 

Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Jude DaShiell
It would be helpful if when pdf get exported from orgmode they have
speech enabled by default.

On Fri, 30 Aug 2019, John Hendy wrote:

> Date: Fri, 30 Aug 2019 10:45:08
> From: John Hendy 
> To: Matt Price 
> Cc: org-mode-email 
> Subject: Re: [O] minimal testing setup for pdf export?
>
> Whew, the world is whole again! No worries, and I've been in the exact
> same situation more than I'd like. We joke at work that if you want to
> fix a problem, just ask someone to come watch it happen and it will
> magically go away :)
>
> Glad you're on your way!
> John
>
> On Fri, Aug 30, 2019 at 9:27 AM Matt Price  wrote:
> >
> >
> >
> > On Thu, Aug 29, 2019 at 11:27 AM John Hendy  wrote:
> >>
> >> On Tue, Aug 27, 2019 at 6:34 PM Matt Price  wrote:
> >> >
> >> >
> >> >
> >> > On Tue, Aug 27, 2019 at 1:33 PM John Kitchin  
> >> > wrote:
> >> >>
> >> >> that does suggest that pdflatex is getting called somewhere else.
> >> >>
> >> >> Maybe you can edebug the export function and check the value of 
> >> >> default-directory to see where it is getting called.
> >> >>
> >> >> You could also try this
> >> >>
> >> >> #+BEGIN_SRC emacs-lisp
> >> >> (defun my-build (quoted-tex-file)
> >> >>   (message "Building %s. Called from %s" quoted-tex-file 
> >> >> default-directory))
> >> >>
> >> >> (setq org-latex-pdf-process 'my-build)
> >> >> #+END_SRC
> >> >>
> >> >> It won't build the pdf, but it will tell you in the messages where it 
> >> >> was called from. It might help figure out what is happening.
> >> >
> >> >
> >> > huh.  that was kinda cool... but the value of default-directory seems to 
> >> > be correct.  However, this helped a bit:
> >> >
> >> > #+BEGIN_SRC emacs-lisp
> >> > (shell-command-to-string "echo $PWD")
> >> >
> >> > #+END_SRC
> >> >
> >> >
> >> > #+RESULTS:
> >> > : /home/matt/src/org-mode
> >> >
> >> > Not sure what's going on here, but this value is the same in a regular 
> >> > emacs and  "emacs -Q".  is this normal?
> >> >
> >>
> >> Did this get solved? It kind of bothers me to think it hasn't. I also
> >> think this is a case where erring on the side of overwhelming details
> >> would help a lot. Could you start from the beginning with the exact
> >> process using emacs -Q, post the full output of *Messages* and *Org
> >> PDF LaTeX Output*? Like in the above, you post the output of $PWD, but
> >> not what the *Messages* buffer contained from John's code. Maybe they
> >> are the same, maybe they are different, but we can't tell.
> >>
> >> Example:
> >> $ cd ~/
> >> $ emacs -Q
> >>
> >> M-x org-version
> >> Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @
> >> /usr/share/emacs/26.2/lisp/org/)
> >>
> >> C-x C-f pdf-test.org
> >>
> >> File contents:
> >> * foo
> >> 
> >>
> >> C-x C-s
> >> C-c C-e l p
> >>
> >> $ ls ~/
> >> pdf-test.org
> >> pdf-test.pdf
> >> pdf-test.tex
> >>
> >> Alternatively, insert the code from John Kitchin:
> >>
> >> Wrote /home/jwhendy/pdf-text.org
> >> org-babel-exp process emacs-lisp at position 8...
> >> Saving file /home/jwhendy/pdf-text.tex...
> >> Wrote /home/jwhendy/pdf-text.tex
> >> Processing LaTeX file pdf-text.tex...
> >> Building pdf-text.tex. Called from /home/jwhendy/
> >> org-compile-file: File "/home/jwhendy/pdf-text.pdf" wasn?t produced.
> >> See "*Org PDF LaTeX Output*" for details
> >>
> >> I still don't feel I understand the full nature of your working
> >> directory, what does and doesn't get saved in that directory, etc. I'd
> >> love to help, but am not able to replicate for you!
> >>
> >> Thanks,
> >> John
> >>
> > John H,
> > Thank you so much for the detailed instructions. I had a moment this 
> > morning so I updated Emacs, rebooted my laptop, and started to follow your 
> > instructions as closely as possible... and I can no longer reproduce my 
> > problem. I feel like I should be happier than I am! I wonder if perhaps 
> > there was some kind of strange path problem caused by a software update 
> > that I didn't pay attention to.
> >
> > In any case, I am as always grateful for the efforts of people on this list 
> > -- I learned at least a little bit about latex export and feel that I might 
> > finally be getting a little closer to where I need to be.
> >
> > Meanwhile, if the issue shows up again I'll be sure to check back in.
> >
> > Thanks!
> > Matt
> >
> >
> >>
> >>
> >> >
> >> >> 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 Tue, Aug 27, 2019 at 8:57 AM Matt Price  wrote:
> >> >>>
> >> >>>
> >> >>>
> >> >>> On Tue, Aug 27, 2019 at 8:27 AM John Kitchin  
> >> >>> wrote:
> >> 
> >>  Can you manually compile the empty.tex file from the command line? eg
> >> 
> >>  pdflatex empty
> >> 
> >> >>> (reposting to group)
> >> >>>
> >> >>> 

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

2019-08-30 Thread Michaël Cadilhac
By the way, I've been using this for quite some time, and I find it quite
useful.  It may be worth considering it for inclusion—see attached patch.
Opinions?



On Thu, 14 Feb 2019 at 06:32, Michaël Cadilhac 
wrote:

> Hi Leo;
>
> On Wed, 13 Feb 2019 at 17:46, Leo Gaspard  wrote:
> > 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`.
>
> Alright, can you give this patch a spin and see if that's what you want?
>
> Cheers;
> M.
>
From aef6f6d3ab553ff83f5cc9b7c0ad26c5cd2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= 
Date: Fri, 30 Aug 2019 12:28:58 -0500
Subject: [PATCH] org-clock: let user provide a list of default clock-in tasks.

* lisp/org-clock.el (org-clock-default-tasks): New variable.
(org-clock-select-task): Implement it.
---
 lisp/org-clock.el | 21 +
 1 file changed, 21 insertions(+)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 9e64645cb..b8523e3e1 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -168,6 +168,18 @@ which case all digits and capital letters are used up by the
   :group 'org-clock
   :type 'integer)
 
+(defcustom org-clock-default-tasks nil
+  "Default tasks that always appear in the clock-in dialog.
+This should be a list of pairs (KEY . ID), where KEY is the key
+used to select the task, and ID is the unique identifier of the
+task."
+  :group 'org-clock
+  :version "26.2"
+  :package-version '(Org . "9.3")
+  :type '(repeat (cons :tag "Key and ID"
+		   (character :tag "Access key")
+		   (string:tag "Task ID"
+
 (defcustom org-clock-goto-may-find-recent-task t
   "Non-nil means `org-clock-goto' can go to recent task if no active clock."
   :group 'org-clock
@@ -626,6 +638,15 @@ there is no recent clock to choose from."
 		   (+ i (- ?A 10))) m))
 	(if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s
 	(push s sel-list)))
+	(let (has-elt m)
+	  (dolist (charid org-clock-default-tasks)
+	;; Only add tasks that actually exist
+	(when (setq m (org-id-find (cdr charid) 'marker))
+	  (unless has-elt
+		(setq has-elt t)
+		(insert (org-add-props "Default Tasks\n" nil 'face 'bold)))
+	  (setq s (org-clock-insert-selection-line (car charid) m))
+	  (push s sel-list
 	(run-hooks 'org-clock-before-select-task-hook)
 	(goto-char (point-min))
 	;; Set min-height relatively to circumvent a possible but in
-- 
2.23.0



Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread John Hendy
Whew, the world is whole again! No worries, and I've been in the exact
same situation more than I'd like. We joke at work that if you want to
fix a problem, just ask someone to come watch it happen and it will
magically go away :)

Glad you're on your way!
John

On Fri, Aug 30, 2019 at 9:27 AM Matt Price  wrote:
>
>
>
> On Thu, Aug 29, 2019 at 11:27 AM John Hendy  wrote:
>>
>> On Tue, Aug 27, 2019 at 6:34 PM Matt Price  wrote:
>> >
>> >
>> >
>> > On Tue, Aug 27, 2019 at 1:33 PM John Kitchin  
>> > wrote:
>> >>
>> >> that does suggest that pdflatex is getting called somewhere else.
>> >>
>> >> Maybe you can edebug the export function and check the value of 
>> >> default-directory to see where it is getting called.
>> >>
>> >> You could also try this
>> >>
>> >> #+BEGIN_SRC emacs-lisp
>> >> (defun my-build (quoted-tex-file)
>> >>   (message "Building %s. Called from %s" quoted-tex-file 
>> >> default-directory))
>> >>
>> >> (setq org-latex-pdf-process 'my-build)
>> >> #+END_SRC
>> >>
>> >> It won't build the pdf, but it will tell you in the messages where it was 
>> >> called from. It might help figure out what is happening.
>> >
>> >
>> > huh.  that was kinda cool... but the value of default-directory seems to 
>> > be correct.  However, this helped a bit:
>> >
>> > #+BEGIN_SRC emacs-lisp
>> > (shell-command-to-string "echo $PWD")
>> >
>> > #+END_SRC
>> >
>> >
>> > #+RESULTS:
>> > : /home/matt/src/org-mode
>> >
>> > Not sure what's going on here, but this value is the same in a regular 
>> > emacs and  "emacs -Q".  is this normal?
>> >
>>
>> Did this get solved? It kind of bothers me to think it hasn't. I also
>> think this is a case where erring on the side of overwhelming details
>> would help a lot. Could you start from the beginning with the exact
>> process using emacs -Q, post the full output of *Messages* and *Org
>> PDF LaTeX Output*? Like in the above, you post the output of $PWD, but
>> not what the *Messages* buffer contained from John's code. Maybe they
>> are the same, maybe they are different, but we can't tell.
>>
>> Example:
>> $ cd ~/
>> $ emacs -Q
>>
>> M-x org-version
>> Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @
>> /usr/share/emacs/26.2/lisp/org/)
>>
>> C-x C-f pdf-test.org
>>
>> File contents:
>> * foo
>> 
>>
>> C-x C-s
>> C-c C-e l p
>>
>> $ ls ~/
>> pdf-test.org
>> pdf-test.pdf
>> pdf-test.tex
>>
>> Alternatively, insert the code from John Kitchin:
>>
>> Wrote /home/jwhendy/pdf-text.org
>> org-babel-exp process emacs-lisp at position 8...
>> Saving file /home/jwhendy/pdf-text.tex...
>> Wrote /home/jwhendy/pdf-text.tex
>> Processing LaTeX file pdf-text.tex...
>> Building pdf-text.tex. Called from /home/jwhendy/
>> org-compile-file: File "/home/jwhendy/pdf-text.pdf" wasn’t produced.
>> See "*Org PDF LaTeX Output*" for details
>>
>> I still don't feel I understand the full nature of your working
>> directory, what does and doesn't get saved in that directory, etc. I'd
>> love to help, but am not able to replicate for you!
>>
>> Thanks,
>> John
>>
> John H,
> Thank you so much for the detailed instructions. I had a moment this morning 
> so I updated Emacs, rebooted my laptop, and started to follow your 
> instructions as closely as possible... and I can no longer reproduce my 
> problem. I feel like I should be happier than I am! I wonder if perhaps there 
> was some kind of strange path problem caused by a software update that I 
> didn't pay attention to.
>
> In any case, I am as always grateful for the efforts of people on this list 
> -- I learned at least a little bit about latex export and feel that I might 
> finally be getting a little closer to where I need to be.
>
> Meanwhile, if the issue shows up again I'll be sure to check back in.
>
> Thanks!
> Matt
>
>
>>
>>
>> >
>> >> 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 Tue, Aug 27, 2019 at 8:57 AM Matt Price  wrote:
>> >>>
>> >>>
>> >>>
>> >>> On Tue, Aug 27, 2019 at 8:27 AM John Kitchin  
>> >>> wrote:
>> 
>>  Can you manually compile the empty.tex file from the command line? eg
>> 
>>  pdflatex empty
>> 
>> >>> (reposting to group)
>> >>>
>> >>> pdflatex empty
>> >>>
>> >>> Seems to work fine. Hmmm...
>> 
>>  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 Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar  
>>  wrote:
>> >
>> > Am 27.08.19 um 12:34 schrieb Matt Price:
>> > > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX 

Re: [O] minimal testing setup for pdf export?

2019-08-30 Thread Matt Price
On Thu, Aug 29, 2019 at 11:27 AM John Hendy  wrote:

> On Tue, Aug 27, 2019 at 6:34 PM Matt Price  wrote:
> >
> >
> >
> > On Tue, Aug 27, 2019 at 1:33 PM John Kitchin 
> wrote:
> >>
> >> that does suggest that pdflatex is getting called somewhere else.
> >>
> >> Maybe you can edebug the export function and check the value of
> default-directory to see where it is getting called.
> >>
> >> You could also try this
> >>
> >> #+BEGIN_SRC emacs-lisp
> >> (defun my-build (quoted-tex-file)
> >>   (message "Building %s. Called from %s" quoted-tex-file
> default-directory))
> >>
> >> (setq org-latex-pdf-process 'my-build)
> >> #+END_SRC
> >>
> >> It won't build the pdf, but it will tell you in the messages where it
> was called from. It might help figure out what is happening.
> >
> >
> > huh.  that was kinda cool... but the value of default-directory seems to
> be correct.  However, this helped a bit:
> >
> > #+BEGIN_SRC emacs-lisp
> > (shell-command-to-string "echo $PWD")
> >
> > #+END_SRC
> >
> >
> > #+RESULTS:
> > : /home/matt/src/org-mode
> >
> > Not sure what's going on here, but this value is the same in a regular
> emacs and  "emacs -Q".  is this normal?
> >
>
> Did this get solved? It kind of bothers me to think it hasn't. I also
> think this is a case where erring on the side of overwhelming details
> would help a lot. Could you start from the beginning with the exact
> process using emacs -Q, post the full output of *Messages* and *Org
> PDF LaTeX Output*? Like in the above, you post the output of $PWD, but
> not what the *Messages* buffer contained from John's code. Maybe they
> are the same, maybe they are different, but we can't tell.
>
> Example:
> $ cd ~/
> $ emacs -Q
>
> M-x org-version
> Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @
> /usr/share/emacs/26.2/lisp/org/)
>
> C-x C-f pdf-test.org
>
> File contents:
> * foo
> 
>
> C-x C-s
> C-c C-e l p
>
> $ ls ~/
> pdf-test.org
> pdf-test.pdf
> pdf-test.tex
>
> Alternatively, insert the code from John Kitchin:
>
> Wrote /home/jwhendy/pdf-text.org
> org-babel-exp process emacs-lisp at position 8...
> Saving file /home/jwhendy/pdf-text.tex...
> Wrote /home/jwhendy/pdf-text.tex
> Processing LaTeX file pdf-text.tex...
> Building pdf-text.tex. Called from /home/jwhendy/
> org-compile-file: File "/home/jwhendy/pdf-text.pdf" wasn’t produced.
> See "*Org PDF LaTeX Output*" for details
>
> I still don't feel I understand the full nature of your working
> directory, what does and doesn't get saved in that directory, etc. I'd
> love to help, but am not able to replicate for you!
>
> Thanks,
> John
>
> John H,
Thank you so much for the detailed instructions. I had a moment this
morning so I updated Emacs, rebooted my laptop, and started to follow your
instructions as closely as possible... and I can no longer reproduce my
problem. I feel like I should be happier than I am! I wonder if perhaps
there was some kind of strange path problem caused by a software update
that I didn't pay attention to.

In any case, I am as always grateful for the efforts of people on this list
-- I learned at least a little bit about latex export and feel that I might
finally be getting a little closer to where I need to be.

Meanwhile, if the issue shows up again I'll be sure to check back in.

Thanks!
Matt



>
> >
> >> 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 Tue, Aug 27, 2019 at 8:57 AM Matt Price  wrote:
> >>>
> >>>
> >>>
> >>> On Tue, Aug 27, 2019 at 8:27 AM John Kitchin 
> wrote:
> 
>  Can you manually compile the empty.tex file from the command line? eg
> 
>  pdflatex empty
> 
> >>> (reposting to group)
> >>>
> >>> pdflatex empty
> >>>
> >>> Seems to work fine. Hmmm...
> 
>  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 Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar 
> wrote:
> >
> > Am 27.08.19 um 12:34 schrieb Matt Price:
> > > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch
> > > Linux) (preloaded format=pdflatex)
> > >  restricted \write18 enabled.
> > > entering extended mode
> > > ! I can't find file `empty.tex'.
> >
> > So pdflatex is called and found. Then pdflatex can't find empty.tex.
> > That looks like pdflatex is called in another directory than where
> > empty.tex resides. How that could happen, no idea.
> >
> > Julius
> >
>


[O] Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]

2019-08-30 Thread immanuel

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.

When org-edit-src-code is called with org-window-setup equal to
'split-window-below or 'split-window-right it will keep splitting the
window if the mouse is clicked on the src block in the org buffer.
This patch tries to address that

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 9134d5b5d..c7e201687 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -786,6 +786,13 @@ Raise an error when current buffer is not a source editing buffer."
   (unless (org-src-edit-buffer-p) (error "Not in a source buffer"))
   org-src--source-type)
 
+(defun org-src-select-window-for-buffer (buffer split-fun)
+  "Tries to select an existing window for buffer or splits the window."
+  (select-window
+   (or
+(display-buffer-reuse-window buffer '())
+(funcall split-fun
+
 (defun org-src-switch-to-buffer (buffer context)
   (pcase org-src-window-setup
 (`current-window (pop-to-buffer-same-window buffer))
@@ -794,12 +801,12 @@ Raise an error when current buffer is not a source editing buffer."
 (`split-window-below
  (if (eq context 'exit)
 	 (delete-window)
-   (select-window (split-window-vertically)))
+   (org-src-select-window-for-buffer buffer #'split-window-vertically))
  (pop-to-buffer-same-window buffer))
 (`split-window-right
  (if (eq context 'exit)
 	 (delete-window)
-   (select-window (split-window-horizontally)))
+   (org-src-select-window-for-buffer buffer #'split-window-horizontally))
  (pop-to-buffer-same-window buffer))
 (`other-frame
  (pcase context


Emacs  : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2019-07-17
Package: Org mode version 9.2.5 (release_9.2.5-504-g3c24be @ 
/home/immanuel/.emacs.d/straight/build/org/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-reveal-start-hook '(org-decrypt-entry)
 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
 auto-fill-mode)
 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-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-babel-load-languages '((emacs-lisp . t) (C) (python . t) (shell . t) 
(plantuml . t))
 org-src-preserve-indentation t
 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-babel-tangle-lang-exts '(("D" . "d") ("C++" . "cpp") ("abc" . "abc") 
("asymptote" . "asy") ("awk" . "awk") ("clojure" . "clj") ("fortran" . "F90") 
("groovy" . "groovy")
  ("haskell" . "hs") ("io" . "io") ("java" . 
"java") ("latex" . "tex") ("LilyPond" . "ly") ("lisp" . "lisp") ("lua" . "lua") 
("maxima" . "max") ("ocaml" . "ml")
  ("perl" . "pl") ("picolisp" . "l") ("processing" 
. "pde") ("ruby" . "rb") ("sed" . "sed") ("vala" . "vala") ("python" . "py") 
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export 
org-attach-export-link :complete org-attach-complete-link) ("id" :follow 
org-id-open)
   ("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)
   

Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Mikhail Skorzhinskii
Adam Porter  writes:
 > However, the org-ql-block version runs in about 1/5th the time (0.7
 > seconds compared to 3.45 seconds on my collection of org-agenda-files).

For some reason I thought that on average org-ql package is working
slower then native org-agenda searches. Probably because there are more
control and interface is much more simpler and cleaner and nothing
comes free of charge. That sort of thing. :-)

I am really glad that I was mistaken. Care to drop a few thoughts on why
this is the case? This is applicable only for ql-block or other org-ql
functions are a bit faster too?

Mikhail Skorzhinskii



Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Adam Porter
Samuel Wales  writes:

> i have been watching these developments with interest.  i want a
> faster 2-day agenda, and really like the idea of a lisp syntax for
> querying, perhaps one that can combine text search with structured.
>
> so just so it's known that there is otherwise silent interest.
> limited in computer use so cannot switch but following.

I appreciate the feedback nonetheless.

A two-day agenda could be done something like this:

(org-ql-agenda (org-agenda-files)
  (and (or (deadline :from today :to +1)
   (scheduled :from today :to +1)
   (ts-active :from today :to +1))
   (not (done)))
  :sort (date priority todo)
  :super-groups ((:auto-planning t)))

To show deadlined entries taking org-deadline-warning-days into account,
more like the traditional Org Agenda, use (deadline auto), like:

(org-ql-agenda (org-agenda-files)
  (and (or (deadline auto)
   (scheduled :from today :to +1)
   (ts-active :from today :to +1))
   (not (done)))
  :sort (date priority todo)
  :super-groups ((:auto-planning t)))

Grouping by date in this example is done with the org-super-agenda
:auto-planning selector, which uses the earliest planning timestamp in
an entry.  So it's not exactly like Org Agenda, but it approximates what
you're asking for, and org-ql's built-in caching may provide a speedup
for subsequent calls.

Here's an example that's similar to the Org Agenda's Log Mode:

(org-ql-agenda
  (or (and (not (done))
   (or (habit)
   (deadline auto)
   (scheduled :to today)
   (ts-active :on today)))
  (closed :on today))
  :sort (date priority todo))





Re: [O] ANN: org-ql agenda block support

2019-08-30 Thread Adam Porter
Milan Zamazal  writes:

> Hi Adam,
>
> thank you for the feature.  I looked at org-ql and org-super-agenda (for
> the first time) and they look interesting.  So interesting that I've
> decided to convert my agendas to it, with some improvements.  It took a
> lot of effort and was sometimes tricky (although probably not more than
> standard Org agendas) but the result is nice and worth it.
>
> I've sent some feedback to the GitHub issue tracker.  On the positive
> note, org-ql + org-super-agenda is superfast, agenda definitions are
> much easier to read, they are also relatively easy to write (once one
> finds out how) and I like the added flexibility.  Overall, I like it,
> it's nice and useful, indeed something like org-agenda-ng.  Thank you
> for your work!

Hi Milan,

Thanks for the kind words.  I'm glad they're useful to you.  And thanks
for your feedback on the tracker; it's very helpful.