Re: refile captured to all opened Org buffer files as targets

2019-12-26 Thread Ihor Radchenko
Thanks!

org-web-tools--html-to-org-with-pandoc is an interesting idea. I was
using elfeed-insert-html for this purpose.

Also, note that your capture may be messed up when the rss content
contains org-mode text. A real-case scenario from Stack Exchange rss: 

> I'd like to find a way to jump to a location in an org-mode file while 
> automatically unfolding only the heading at the location I'm jumping to and 
> all its parent headings (but not any sibling headings).
> 
> For example, if I have this org-mode file:
> 
> * A
> ** AA

If you insert the rss entry contents as is, two unexpected headings will
be created.

I use the following to escape possible org-mode text:

  (setq content-text (with-temp-buffer (when content
 (if (eq 
content-type 'html)
 
(elfeed-insert-html content)
   (insert 
content)))
   (let 
((org-babel-min-lines-for-block-output 0)) ;; handle org-mode syntax in body
 
(org-escape-code-in-region (point-min) (point-max)))
   (buffer-string)))

Best,
Ihor


stardiviner  writes:

> Ihor Radchenko  writes:
>
>> [offtopic]
>>
>>> I recently created an org-capture template for elfeed, it is finished. 
>>
>> Could you share your capture template?
>
> Sure, here it is:
>
> #+begin_src emacs-lisp
> ;; support Org Mode Capture template
> (defun my/org-capture-elfeed-title ()
>   (with-current-buffer "*elfeed-entry*"
> (elfeed-entry-title elfeed-show-entry)))
> (defun my/org-capture-elfeed-date ()
>   (with-current-buffer "*elfeed-entry*"
> (format-time-string
>  "[%Y-%m-%d %a %H:%M]"
>  (seconds-to-time (elfeed-entry-date elfeed-show-entry)
> (defun my/org-capture-elfeed-source ()
>   (with-current-buffer "*elfeed-entry*"
> (let ((feed (elfeed-entry-feed elfeed-show-entry)))
>   (elfeed-feed-title feed
> (defun my/org-capture-elfeed-content ()
>   (with-current-buffer "*elfeed-entry*"
> (let* ((content (elfeed-deref (elfeed-entry-content elfeed-show-entry)))
>(type (elfeed-entry-content-type elfeed-show-entry))
>(feed (elfeed-entry-feed elfeed-show-entry))
>(base-url (and feed (elfeed-compute-base (elfeed-feed-url feed)
>   (if content
>   (if (eq type 'html)
>   (org-web-tools--html-to-org-with-pandoc content)
> (insert content))
>
> (add-to-list 'org-capture-templates
>  '("R" "Capture elfeed [R]SS feed content to Org buffer"
>entry (file "")
>"* %(my/org-capture-elfeed-title)
> :PROPERTIES:
> :SOURCE: %(my/org-capture-elfeed-source)
> :DATE(original): %(my/org-capture-elfeed-date)
> :DATE: %u
> :END:
>
> %(my/org-capture-elfeed-content)"
>:empty-lines 1
>:jump-to-captured t))
> #+end_src
>
> If possible, I might submit this PR to elfeed.el repository.
>
> -- 
> [ stardiviner ]
>I try to make every word tell the meaning what I want to express.
>
>Blog: https://stardiviner.github.io/
>IRC(freenode): stardiviner, Matrix: stardiviner
>GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>   




begin_src latex -> pdf

2019-12-26 Thread Michael Welle
Hello,

this works as expected:

#+begin_src latex  :file foo.png :exports results :results file raw
Hello, crude world
#+end_src

foo.png is created in the org file's directory. Shouldn't the
following do the same, except with a pdf file?

#+begin_src latex  :file foo.pdf :exports results :results file raw
Hello, crude world
#+end_src

When cc'ing that block I got this message:

Evaluate this latex code block on your system? (y or n) y
executing Latex code block...
Processing LaTeX file /tmp/tmp_welle/latex-sCpRjQ.tex...
org-compile-file: File "/tmp/tmp_welle/latex-sCpRjQ.pdf" wasn’t produced.  See 
"*Org PDF LaTeX Output*" for details

The mentioned log buffer doesn't indicate an error.

In the org file's directory I find

 -rw-rw  1 welle welle  8 Dec 27 08:14 latex-sCpRjQ.aux
 -rw-rw  1 welle welle  34823 Dec 27 08:14 latex-sCpRjQ.log
 -rw-rw  1 welle welle  12433 Dec 27 08:14 latex-sCpRjQ.pdf

The pdf file is correct.

I /tmp/tmp_welle I find

 -rw---  1 welle welle  907 Dec 27 08:14 latex-sCpRjQ.tex

It seems like parts of org think the compilation is done in the tmp
dir, while the cwd (where compilation results are stored) is the org
file's dir. 


Regards
hmw



Re: Release 9.3.1

2019-12-26 Thread Pankaj Jangid
> Org 9.3.1, a bugfix release, is out.
Is this merged into emacs-27 branch?



Re: refile captured to all opened Org buffer files as targets

2019-12-26 Thread Adam Porter
stardiviner  writes:

> I recently created an org-capture template for elfeed, it is finished. Now I
> have an idea is to refile it to all currently opened Org buffer files. So I
> created an function for ~org-refile-targets~ variable.
>
> #+begin_src emacs-lisp
> (defun org-refile-targets-all-files ()
>   "Use all currently opened Org buffer files as org-refile targets."
>   (mapcar 'buffer-file-name
>   (seq-filter (lambda (buffer) (if-let (file (buffer-file-name 
> buffer)) (f-ext? file "org"))) ; filter Org buffers
>   (buffer-list
> #+end_src
>
>
> Then set ~org-refile-targets~ to use upper custom function
>
> #+begin_src emacs-lisp :eval no
> (setq org-refile-targets '((nil :maxlevel . 3) ; current buffer headlies
>(org-agenda-files :maxlevel . 2) ; agenda files 
> headlines
>(org-refile-targets-all-files :maxlevel . 3) ; all 
> opened Org buffer files headlines
>))
> #+end_src
>
> Can I add this as a patch to Org Mode repository?

org-buffer-list is a compiled Lisp function in ‘org.el’.

(org-buffer-list  PREDICATE EXCLUDE-TMP)

Return a list of Org buffers.
PREDICATE can be ‘export’, ‘files’ or ‘agenda’.

export   restrict the list to Export buffers.
filesrestrict the list to buffers visiting Org files.
agenda   restrict the list to buffers visiting agenda files.

If EXCLUDE-TMP is non-nil, ignore temporary buffers.





Re: How to get parsed output of org-eww-copy-for-org-mode ?

2019-12-26 Thread stardiviner


This is very interesting, thanks.

I will reference your code.

Bob Newell  writes:

> I don't seem to have any trouble with org-eww-copy-for-org-mode. I
> capture with a capture template. The code below may be longer or more
> than you want, but it works for me.
>
> My capture template is this:
>
>  ("w" "Website" plain
>   (function org-website-clipper)
>   "* %a\n%T\n" :immediate-finish t)
>
> And it depends on the following code.
>
>   (require 'ol-eww)
>   (require 'ol-w3m)
>
> ;;; Change this to suit:
> (defvar org-website-page-archive-file "~/organize/website/websites.org")
> (defun org-website-clipper ()
>   "When capturing a website page, go to the right place in capture file,
>but do sneaky things. Because it's a w3m or eww page, we go
>ahead and insert the fixed-up page content, as I don't see a
>good way to do that from an org-capture template alone. Requires
>Emacs 25+ and the 2017-02-12 or later patched version of org-eww.el."
>  (interactive)
>
> ;;; Address the plague of trailing whitespace in some web buffers.
>
>  (let ((buffer-read-only nil))
>   (delete-trailing-whitespace))
>
> ;;; Check for acceptable major mode (w3m or eww) and set up a couple of
> ;;; browser specific values. Error if unknown mode.
>
>   (cond
>((eq major-mode 'w3m-mode)
>  (org-w3m-copy-for-org-mode))
>((eq major-mode 'eww-mode)
>  (org-eww-copy-for-org-mode))
>(t
>  (error "Not valid -- must be in w3m or eww mode")))
>
> ;;; Check if we have a full path to the archive file.
> ;;; Create any missing directories.
>
>   (unless (file-exists-p org-website-page-archive-file)
> (let ((dir (file-name-directory org-website-page-archive-file)))
>   (unless (file-exists-p dir)
> (make-directory dir
>
>   ;; Open the archive file and yank in the content.
>   ;; Headers are fixed up later by org-capture.
>
>   (find-file org-website-page-archive-file)
>   (goto-char (point-max))
>   ;; Leave a blank line for org-capture to fill in
>   ;; with a timestamp, URL, etc.
>   (insert "\n\n")
>   ;; Insert the web content but keep our place.
>   (save-excursion (yank))
>   ;; Don't keep the page info on the kill ring.
>   ;; Also fix the yank pointer.
>   (setq kill-ring (cdr kill-ring))
>   (setq kill-ring-yank-pointer kill-ring)
>   ;; Final repositioning.
>   (forward-line -1)
> )


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

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



Re: refile captured to all opened Org buffer files as targets

2019-12-26 Thread stardiviner


Ihor Radchenko  writes:

> [offtopic]
>
>> I recently created an org-capture template for elfeed, it is finished. 
>
> Could you share your capture template?

Sure, here it is:

#+begin_src emacs-lisp
;; support Org Mode Capture template
(defun my/org-capture-elfeed-title ()
  (with-current-buffer "*elfeed-entry*"
(elfeed-entry-title elfeed-show-entry)))
(defun my/org-capture-elfeed-date ()
  (with-current-buffer "*elfeed-entry*"
(format-time-string
 "[%Y-%m-%d %a %H:%M]"
 (seconds-to-time (elfeed-entry-date elfeed-show-entry)
(defun my/org-capture-elfeed-source ()
  (with-current-buffer "*elfeed-entry*"
(let ((feed (elfeed-entry-feed elfeed-show-entry)))
  (elfeed-feed-title feed
(defun my/org-capture-elfeed-content ()
  (with-current-buffer "*elfeed-entry*"
(let* ((content (elfeed-deref (elfeed-entry-content elfeed-show-entry)))
   (type (elfeed-entry-content-type elfeed-show-entry))
   (feed (elfeed-entry-feed elfeed-show-entry))
   (base-url (and feed (elfeed-compute-base (elfeed-feed-url feed)
  (if content
  (if (eq type 'html)
  (org-web-tools--html-to-org-with-pandoc content)
(insert content))

(add-to-list 'org-capture-templates
 '("R" "Capture elfeed [R]SS feed content to Org buffer"
   entry (file "")
   "* %(my/org-capture-elfeed-title)
:PROPERTIES:
:SOURCE: %(my/org-capture-elfeed-source)
:DATE(original): %(my/org-capture-elfeed-date)
:DATE: %u
:END:

%(my/org-capture-elfeed-content)"
   :empty-lines 1
   :jump-to-captured t))
#+end_src

If possible, I might submit this PR to elfeed.el repository.

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

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



Re: refile captured to all opened Org buffer files as targets

2019-12-26 Thread stardiviner


I improved command to get ride of =f.el= library function:

#+begin_src emacs-lisp
(defun org-refile-targets-all-files ()
  "Use all currently opened Org buffer files as org-refile targets."
  (mapcar 'buffer-file-name
  (seq-filter ; filter Org buffers
   (lambda (buffer)
 (if-let (file (buffer-file-name buffer))
 (string-equal (file-name-extension file) "org")
   ;; (f-ext? file "org")
   ))
   (buffer-list
#+end_src

Here is the configured option:

#+begin_src emacs-lisp
(setq org-refile-targets '((nil :maxlevel . 3) ; current buffer headlines
   (org-agenda-files :maxlevel . 2) ; agenda files 
headlines
   (org-refile-targets-all-files :maxlevel . 3) ; all 
opened Org buffer files headlines
   ))
#+end_src

I think this can be an option for user who might think this is useful like in my
situation. (I want to refile capture elfeed RSS entry to one of my opened Org
buffer's specific headline.)

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

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



Bug: C-c C-k show branches also expands archived headings [9.3.1 (9.3.1-elpaplus @ /home/ionasal/.emacs.d/elpa/org-plus-contrib-20191226/)]

2019-12-26 Thread Allen Li
The command org-kill-note-or-show-branches bound to C-c C-k when used to
show branches also expands headings tagged with :ARCHIVE:.  This is
contrary to expectations, as the manual states:

‘C-c C-k’ (‘outline-show-branches’)
 Expose all the headings of the subtree, CONTENTS view for just one
 subtree.

CONTENTS view when using TAB cycling does not expand archived headings.

Can be reproduced with a .org file containing:

* Foo
** Bar :ARCHIVE:
*** Baz

Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10)
 of 2019-08-29
Package: Org mode version 9.3.1 (9.3.1-elpaplus @ 
/home/ionasal/.emacs.d/elpa/org-plus-contrib-20191226/)



Re: [O] [BUG] Infinite loop in org-agenda-show-new-time

2019-12-26 Thread Andrew Hyatt
I've been having this same issue - the issue is quite reproducible for me,
and it has been for years.  I just finally grew tired of the issue and
decided to investigate it, and yes, the issue is org-agenda-show-new-time.

I also have invisible entries in the org buffer, and the call to
org-move-to-column apparently will move several lines forward, which causes
us to process the same lines over and over.

Wrapping the call to org-move-to-column with a let setting the
buffer-invisibility-spec to nil does fix the issue.


On Fri, Aug 23, 2013 at 8:08 AM Nick Dokos  wrote:

> Carsten Dominik  writes:
>
> > I also do not expect negative consequences.  Please apply the patch,
> will you?
> >
>
> OK - patch attached. NB: there is at least one place where the "wrap the
> call to org-move-to-column" has been applied, in
> org.el:`org-comment-or-uncomment-region', presumably for exactly this
> reason. If this patch does not cause unexpected problem, then the
> wrapped setting above can be cleaned up.
>
>
> I hope it conforms to conventions but let me know of any problems.
> --
> Nick
>


Release 9.3.1

2019-12-26 Thread Bastien
Hi all,

Org 9.3.1, a bugfix release, is out.

Enjoy!

-- 
 Bastien




equal syntax highlighting for publishing code blocks to html and pdf

2019-12-26 Thread Johannes Brauer
Hi!
Frequently I publish org-mode documents containing source code blocks to html 
(htmlize) and pdf (minted). I would like to see the same colors in both export 
types. But 
I cannot figure out, what’s the best way to achieve this.

Has anyone solved this problem? Are there any hints?

Johannes



problem with org-toggle-inline-images - SORRY - WRONG SUBJECT

2019-12-26 Thread Johannes Brauer
Hi!
Frequently I publish org-mode documents containing source code blocks to html 
(htmlize) and pdf (minted). I would like to see the same colors in both export 
types. But 
I cannot figure out, what’s the best way to achieve this.

Has anyone solved this problem? Are there any hints?

Johannes



problem with org-toggle-inline-images

2019-12-26 Thread Johannes Brauer
Hi!
Frequently I publish org-mode documents containing source code blocks to html 
(htmlize) and pdf (minted). I would like to see the same colors in both export 
types. But 
I cannot figure out, what’s the best way to achieve this.

Has anyone solved this problem? Are there any hints?

Johannes



RE: [Idea] Org Collections

2019-12-26 Thread Gustav Wikström
Hi,

> -Original Message-
> From: Roland Everaert 
> Sent: den 23 december 2019 14:32
> To: Gustav Wikström 
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [Idea] Org Collections

> Have you had a look at org-brain. I don't use is much, but there are some
> overlapping functionnality to merge, maybe.

Yeah, I'm a Org brain user. In my mind the collections and the active
collection would ideally be what the Org brain would operate on. 

> >> Did you think about the specific UI of aspects management?
> >> Proposal of UI I particularly like:
> >> - Mu4E
> >> - forge/magit
> >
> > Not really.. Except I agree with you on magit. The other I haven't used.
> 
> Mu4E is a major mode for managing e-mails using the mu index. it provides
> a main view with bookmarks and entries to perform searches and composing
> message, among othe thing, but what I find more useful are the header
> view, which displays a multi-columns list of e-mails with associated meta-
> data and a message view allowing to view the content of an e-mail. The
> header view allows for bulk actions while the message view act, obiously,
> on the current message and permit replying and transfering the current e-
> mail.

Ah ok, thanks for the description! I think a UI for collections still
is quite far away. This is a hobby project after all and it may take
quite some time before anything useful is created. But it's good with
some pointers to inspirational material!

Regards,
Gustav