Re: [Feature] add a new org-attach dispatcher command to offline save web page

2020-05-27 Thread Ihor Radchenko
> This looks helpful, but I think this should be an add-on rather than
> integrated into the org-attach. I'm glad to learn about monolith, but
> far fewer users are likely to have it installed than have wget or curl
> installed. You might also want to check out org-board, which has similar
> functionality:

It does not mean that attaching URL directly is not worth including into
org. This sounds pretty common use case, especially considering the number
of packages providing similar feature. You mentioned org-board, but
there is also org-download and org-web-tools.

I agree that monolith is completely uncommon tool and I would not expect
the majority of users to have it installed, but the same functionality
utilising built-in url.el (as a default) should be acceptable.

Best,
Ihor


Matthew Lundin  writes:

> stardiviner  writes:
>
>> I attached the patch.
>>
>> I think this feature will be helpful for use who archive web page data 
>> usually
>> like me. To be more portable, I also added an defcustom option for other
>> external command. And use an if condition to detect whether external command
>> available, else warning user.
>
> This looks helpful, but I think this should be an add-on rather than
> integrated into the org-attach. I'm glad to learn about monolith, but
> far fewer users are likely to have it installed than have wget or curl
> installed. You might also want to check out org-board, which has similar
> functionality:
>
> https://github.com/scallywag/org-board
>
> Best,
>
> Matt
>

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg



[PATCH] goto: Avoid invoking org-mode for outline navigation

2020-05-27 Thread Kyle Meyer
Kyle Meyer writes:

> Ihor Radchenko writes:
>
>> Is there even a need to call the whole (org-mode). The new buffer is
>> an indirect buffer. It should already have org-mode activated (at least,
>> we can check for it and not call (org-mode) unnecessarily). If we just
>> want to reset initial visibility, (org-overview) is already doing the
>> job of (org-set-startup-visibility) from (org-mode).
>
> Hmm, thanks for taking a step back.  It does seem like the org-mode call
> should be unnecessary. (I haven't tried yet.)

Based on light testing, dropping the org-mode call doesn't seem to break
anything.  I don't use the outline interface to org-goto, so it'd be
appreciated if anyone who does could try it out and see if anything
feels off.

-- >8 --
Subject: [PATCH] goto: Avoid invoking org-mode for outline navigation

* lisp/org-goto.el (org-goto-location): Call make-indirect-buffer with
a non-nil CLONE to preserve the base buffer's state, avoiding a more
expensive call to org-mode.

Reported-by: Vladimir Nikishkin 
Suggested-by: Ihor Radchenko 
---
 lisp/org-goto.el | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/lisp/org-goto.el b/lisp/org-goto.el
index 6d4c0cbf2..56786696e 100644
--- a/lisp/org-goto.el
+++ b/lisp/org-goto.el
@@ -234,20 +234,15 @@ (defun org-goto-location ( _buf help)
 (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
 (pop-to-buffer-same-window
  (condition-case nil
- (make-indirect-buffer (current-buffer) "*org-goto*")
-   (error (make-indirect-buffer (current-buffer) "*org-goto*"
+ (make-indirect-buffer (current-buffer) "*org-goto*" t)
+   (error (make-indirect-buffer (current-buffer) "*org-goto*" t
 (let (temp-buffer-show-function temp-buffer-show-hook)
   (with-output-to-temp-buffer "*Org Help*"
   (princ (format help (if org-goto-auto-isearch
   "  Just type for auto-isearch."
 "  n/p/f/b/u to navigate, q to quit.")
 (org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
-(setq buffer-read-only nil)
-(let ((org-startup-truncated t)
-  (org-startup-folded nil)
-  (org-startup-align-all-tables nil))
-  (org-mode)
-  (org-overview))
+(org-overview)
 (setq buffer-read-only t)
 (if (and (boundp 'org-goto-start-pos)
  (integer-or-marker-p org-goto-start-pos))

base-commit: 516c038e5f65911c32de1054925ce9e848c3f2d7
-- 
2.26.2




How to both export html and show the code?

2020-05-27 Thread George Mauer
I would like to both render html and show a source block for the rendered
html (I am aware of ob-browser, but I want this to be dynamic html content,
not an image)

I would have thought the following would work, but noweb returns an empty
string

Well, this is solvable with css is it not?

#+name: challenge-1-solution
#+begin_export html

  
  
#gradient-colors div {
  width: 400px;
  height: 200px;
  animation: gradient 5s infinite linear;
}
@keyframes gradient {
  0% {
background-color: hsl(0, 100%, 50%);
  }
  25% {
background-color: hsl(90, 100%, 50%);
  }
  50% {
background-color: hsl(180, 100%, 50%);
  }
  75% {
background-color: hsl(270, 100%, 50%);
  }
  100% {
background-color: hsl(360, 100%, 50%);
  }
}
  

#+end_export
#+begin_src html :eval no :exports code :noweb yes
  <>
#+end_src


Bug: Subtle bug with calling "noweb" blocks with already computed :results output code and :cache yes [9.3.4 (9.3.4-5-ga0f3bb-elpa @ /home/lockywolf/.emacs.d/elpa/org-20200210/)]

2020-05-27 Thread Vladimir Nikishkin



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.


This bug is a bit hard to formulate. Have a look at the following
org-file. Even though it's big, it's almost an MWE:

```

# -*- mode: org;  -*-

* Test
:PROPERTIES:
:header-args::cache yes :noweb yes
:END:


#+name: empty
#+begin_quote

#+end_quote

#+name: runner
#+header: :stdin empty  :exports code
#+begin_src shell :results output code :exports both
printf "%s\n%s" "Test string" "Test string2"
#+end_src

#+RESULTS[16ba04c7554c3436156f295ef43c8a0d2f2d9270]: runner
#+begin_src shell
Test string
Test string2
#+end_src


#+name: c-test-preserving-standard
#+header: :stdin empty  :exports code
#+begin_src shell :results output code
<>
#+end_src

#+RESULTS[16ba04c7554c3436156f295ef43c8a0d2f2d9270]: c-test-preserving-standard
#+begin_src shell
Test string
Test string2
#+end_src

#+name: c-test-preserving-unoptimized
#+header: :stdin empty  :exports code
#+begin_src shell :results output
<>
#+end_src

#+RESULTS[f9468f703a0c54b8601296d5332d51743d70fd05]: 
c-test-preserving-unoptimized
: Test string
: Test string2


#+header: :stdin empty
#+begin_src shell :results output code :wrap src patch :exports both
  output1=$(
  cat <<'EOF'
  <>
  EOF
  )


  output2=$(
  cat <<'EOF'
  <>
  EOF
  )

  diff -w -s -y <(echo "$output1") <(echo "$output2") | nl -w2 - 
#+end_src

#+RESULTS[2b14ae1ffc337f1857d2a3a75e890c3c3cb03d87]:
#+begin_src patch
 1  nil   | Test 
string
 2> Test 
string2
#+end_src

```

You can see that the patch gives two different results for an identical body.

The difference really is in: ":results output code"

This is a bit hard to reproduce, because it also seems to depend on
whether the block was cached, but I find it hard to formulate how
exactly.

In any case, the desired behaviour for me seems to be: take both results from
cache, if they are available, and run the comparison block. If the
cache is outdated, run each outdated block, update the cache, and feed
the cache results into the comparison block.

At the moment org doesn't seem to be updating the cache.

I can imagine thought that if the block output is considered "code",
someone may feel inclined to run the code instead of feeding it verbatim.


Emacs  : GNU Emacs 26.3 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 
3.24.12)
 of 2019-11-26
Package: Org mode version 9.3.4 (9.3.4-5-ga0f3bb-elpa @ 
/home/lockywolf/.emacs.d/elpa/org-20200210/)

current state:
==
(setq
 org-src-mode-hook '((lambda nil (modify-syntax-entry 60 ".") 
(modify-syntax-entry 62 ".")
  (setq geiser-autodoc--inhibit t))
 org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-latex-listings t
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-after-execute-hook '((lambda nil
 (if org-inline-image-overlays
  (progn (org-redisplay-inline-images)))
 )
)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-export-with-sub-superscripts '{}
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-pretty-entities t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-link-descriptive nil
 org-latex-pdf-process '("latexmk  -lualatex -outdir=%o -f %f")
 org-agenda-files '("~/Personal_Planner/Planner.org" 
"~/Personal_Planner/lockywolf_net.org"
"~/Personal_Planner/cyberpunk_smarthome.org"
"~/Personal_Planner/notes.org"
"~/Personal_Planner/2020-04-28-hotkeys-to-remember.txt.org"
"~/DevLinux/chibi-sicp/index.org")
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-modules '(org-habit ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info 
ol-irc ol-mhe
   ol-rmail ol-eww)
 org-plantuml-jar-path "/usr/local/bin/plantuml.jar"
 org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree] 2]
 turn-on-org-cdlatex org-tempo-setup
 (lambda nil
  (add-to-list (quote org-structure-template-alist)
   (quote ("p" . "src plantuml :noweb no :exports both :file 
")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("SO" . "src scheme :exports both :results output")))
  (add-to-list (quote org-structure-template-alist)
   

Re: [Feature] add a new org-attach dispatcher command to offline save web page

2020-05-27 Thread Matthew Lundin
stardiviner  writes:

> I attached the patch.
>
> I think this feature will be helpful for use who archive web page data usually
> like me. To be more portable, I also added an defcustom option for other
> external command. And use an if condition to detect whether external command
> available, else warning user.

This looks helpful, but I think this should be an add-on rather than
integrated into the org-attach. I'm glad to learn about monolith, but
far fewer users are likely to have it installed than have wget or curl
installed. You might also want to check out org-board, which has similar
functionality:

https://github.com/scallywag/org-board

Best,

Matt



Re: Trivial fix for (void-function org-get-outline-path) in org-eldoc.

2020-05-27 Thread Kyle Meyer
Jacob MacDonald writes:

> I noticed that after updating my Org I was getting errors instead of
> eldoc locations in my .org buffers. Thankfully the fix was a simple
> oneliner. Patch attached.

As you noted in your next message, this ended up being a part of a
larger issue and resolved with a fix for that.  But thank you for taking
the time to send a patch!



Re: Possible fix for :includes header argument in org-babel C source blocks

2020-05-27 Thread Kyle Meyer
Kévin Le Gouguec writes:

> Bastien  writes:
>
>> Brandon Guttersohn  writes:
>>
>>> Hey all, I think I may have a small fix for executing C source blocks
>>> in org-babel. Or, possibly just a bad case of user error.
>>>
>>> The issue (in emacs 27 with -q) is that it doesn't seem possible to
>>> specify non-system header files with the :includes header argument.
>>>
>>> [...]
>>>
>>> The attached patch will wrap filenames in quotes if they do not begin
>>> with "<", and works for me.
>>
>> Thanks for reporting this and for suggesting this patch, I think it is
>> good enough.  I have applied it to the master branch of Org:
>>
>> https://code.orgmode.org/bzg/org-mode/commit/44cb98fdb6

I think this discussion was on emacs-devel only, so here are some links
for others who might go looking for more context:

  https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg01880.html
  https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg03051.html

> I think this commit might have broken test ob-C/string-var: running
> "make test" on master (516c038e5) right now I get:
>
>> Test ob-C/string-var condition:
>> (wrong-type-argument sequencep )
>>FAILED8/834  ob-C/string-var (0.004651 sec)

Thanks.  I started seeing that as well but hadn't looked into it yet.

> The following patch fixes the test:
>
> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
> index c3e72c680..ae7b2ed1c 100644
> --- a/lisp/ob-C.el
> +++ b/lisp/ob-C.el
> @@ -233,6 +233,7 @@ its header arguments."
>   ;; includes
>   (mapconcat
>(lambda (inc)
> +(when (symbolp inc) (setq inc (symbol-name inc)))
>  (if (string-prefix-p "<" inc)
>  (format "#include %s" inc)
>(format "#include \"%s\"" inc)))
>
> I don't know if it's the best way forward; another way to make the test
> pass is double-quoting "" and "" in ob-C-test.org:

The above looks reasonable to me...

> diff --git a/testing/examples/ob-C-test.org b/testing/examples/ob-C-test.org
> index 0faf630b9..efae02a19 100644
> --- a/testing/examples/ob-C-test.org
> +++ b/testing/examples/ob-C-test.org
> @@ -38,7 +38,7 @@
>  #+end_src
>  
>  #+source: string_var
> -#+begin_src cpp :var q="word" :includes '( ) :results 
> silent
> +#+begin_src cpp :var q="word" :includes '("" "") :results 
> silent
>std::cout << q << ' ' << std::strlen(q);
>return 0;
>  #+end_src

...given this test seems to be explicitly checking that case.

> I guess there might be some people out there who will expect things to
> keep working without double-quotes?  I have never used Babel, so I have
> no idea…

I don't know either, but the test does make me think so.  Hopefully
Brandon, Bastien, or someone else will chime in if that's not the case.

Could you send the first patch with a commit message tacked on?

Thanks again!



Bug: Org LaTeX preview scaling bug under Windows [9.1.9 (release_9.1.9-65-g5e4542 @ c:/bin/emacs-26.3-x86_64/share/emacs/26.3/lisp/org/)]

2020-05-27 Thread gennady.uraltsev
Dear Everyone,

 

Using official emacs 26.3 binaries for Windows, TexLive, and imagemagick
LaTeX preview messes up if 

scale in org-format-latex-options is set to 1.5 or higher.  To reproduce try
saving the following (also attached) as an org file and running it with a
completely clean emacs setup. Call the source code blocks and
org-toggle-latex-fragment on the fragments in order. If the scale is set to
1.49 or lower everything works fine. If it is set to 1.5 or higher the
pagination is messed up. I tried playing with the latex template but I do
not know enough about it. Sorry

 

Attaching a screenshot of the result. I do not have a Linux box to test this
bug. 

 

After the org file I included the relevant version strings for the programs
in use. 

 

Best,

 

Gennady. 

 

#+BEGIN_SRC emacs-lisp

(setq 

temporary-file-directory "c:/Users/guraltsev/AppData/Local/Temp/"

 

org-latex-pdf-process

'("%latex -interaction nonstopmode -output-directory %o %f" "%latex
-interaction nonstopmode -output-directory %o %f" "%latex -interaction
nonstopmode -output-directory %o %f")

 

org-preview-latex-default-process 'imagemagick)

)

#+END_SRC

 

#+RESULTS:

: imagemagick

 

 

#+BEGIN_SRC emacs-lisp

(setq 

org-format-latex-options

'(:foreground default :background default :scale 1.49 :html-foreground
"Black" :html-background "Transparent" :html-scale 1.0 :matchers

("begin" "$1" "$" "$$" "\\(" "\\["))

)

#+END_SRC

 

#+RESULTS:

| :foreground | default | :background | default | :scale | 1.49 |
:html-foreground | Black | :html-background | Transparent | :html-scale |
1.0 | :matchers | (begin $1 $ $$ \( \[) |

 

 

\begin{equation}

  \mathbb{R} \subset   \mathbb{C}

\end{equation}

 

#+BEGIN_SRC emacs-lisp

(setq 

org-format-latex-options

'(:foreground default :background default :scale 1.5 :html-foreground
"Black" :html-background "Transparent" :html-scale 1.0 :matchers

("begin" "$1" "$" "$$" "\\(" "\\["))

)

#+END_SRC

 

#+RESULTS:

| :foreground | default | :background | default | :scale | 1.5 |
:html-foreground | Black | :html-background | Transparent | :html-scale |
1.0 | :matchers | (begin $1 $ $$ \( \[) |

 

\begin{equation}

  \mathbb{Q} \subset \mathbb{R}

\end{equation}

 

 

 

 

 

pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX)
kpathsea version 6.3.2
Copyright 2020 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.02

 

 

Version: ImageMagick 7.0.10-13 Q16 x64 2020-05-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms
lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib

 

 

 

Emacs  : GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)

of 2019-08-29

Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @
c:/bin/emacs-26.3-x86_64/share/emacs/26.3/lisp/org/)

 

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 "\300\301\302\303\304$\207"

 [add-hook change-major-mode-hook
org-show-block-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-preview-latex-default-process 'imagemagick

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-tab-first-hook 

Re: Bug: 20200525 release: invalid function: org-preserve-local-variables [9.3.6 (9.3.6-75-gb614ed-elpa @ /home/jgoerzen/.emacs.d/elpa/org-20200525/)]

2020-05-27 Thread Kyle Meyer
John Goerzen writes:

> I recently have upgraded to org 20200525 from your package repo because
> org-roam requires a newer org-mode than I had.  GNU ELPA has 9.3.6,
> which would be new enough, but all of my machines fail downloading the
> tar of that version from ELPA with "invalid request", so I'm on
> 20200525.
>
> Many actions, and in particular refile, produce:
>
> Invalid function: org-preserve-local-variables
>
> and fail.
>
> (org-refile) is defined in org.el but why it doesn't seem to be seeing
> org-macs is beyond me.

I installed elpa/org-20200525 in a vanilla environment, and I wasn't
able to trigger any similar failures when refiling.  My best guess is
that it's due to an interaction with the older Org that comes built-in
with Emacs and lacks the org-preserve-local-variables macro.  It's
probably worth uninstalling/reinstalling, making sure the built-in Org
isn't loaded.



Re: Regression from 9.3 to 9.3.6: newlines getting swallowed on org-capture

2020-05-27 Thread Kevin Liu
Thanks, it does indeed seem to be fixed on master.

On 27 May 2020 18:23, Kyle Meyer  wrote:

> Kevin Liu writes:
>
>> Basically, the last position in the narrowed org-capture is actually
>> the first position on the next line, so when you go to (end-of-buffer)
>> and start typing you start clobbering the next headline.
>>
>> I tested this with emacs -Q, capturing an `entry` with `file+headline`
>> in org 9.3 and it was working as expected, then in that same session
>> loaded 9.3.6 and the capture buffer was one character longer (the
>> added newline at the end) enabling the clobbering behavior.
>
> I believe Bastien fixed this in cb2774d1a (org-capture.el: Fix possibly
> missing final newline, 2020-02-18).




Re: Regression from 9.3 to 9.3.6: newlines getting swallowed on org-capture

2020-05-27 Thread Kyle Meyer
Kevin Liu writes:

> Basically, the last position in the narrowed org-capture is actually
> the first position on the next line, so when you go to (end-of-buffer)
> and start typing you start clobbering the next headline.
>
> I tested this with emacs -Q, capturing an `entry` with `file+headline`
> in org 9.3 and it was working as expected, then in that same session
> loaded 9.3.6 and the capture buffer was one character longer (the
> added newline at the end) enabling the clobbering behavior.

I believe Bastien fixed this in cb2774d1a (org-capture.el: Fix possibly
missing final newline, 2020-02-18).



[O] Help speeding up Org iCal export

2020-05-27 Thread Ken Mankoff
Hello,

When I eval `(org-icalendar-combine-agenda-files nil)`, it takes about 15 
seconds.

Some strange messages in the *Messages* buffer include:

22 files scanned, 7 files contains IDs and in total 23 IDs found.

But my `org-agenda-files` variable only contains 12 files and no #+INCLUDE 
statements.

There are also several dozen lines of

org-babel-exp process sh at position 74770...
org-babel-exp process sh at position 74830...
org-babel-exp process sh at position 75147...
...
org-babel-exp process sqlite at position 27700...
org-babel-exp process sqlite at position 27704...
org-babel-exp process sh at position 27604...
org-babel-exp process sh at position 27617...
org-babel-exp process sh at position 27691...
org-babel-exp process translate at position 27970...

(and with bash, python, emacs-lisp, and other languages). When I view for 
example the only #BEGIN_SRC translate block in any of my files it is just a 
test in my notes file:

#+BEGIN_SRC translate :src en :dest da
This is a test
#+END_SRC

I cannot eval it with C-c C-c because I have set ":eval no" system-wide with:

  (setq org-babel-default-header-args
(cons '(:eval . "no")
  (assq-delete-all :eval org-babel-default-header-args)))


Sometimes the Messages contain confirmation that a code block is disabled:

org-babel-exp process plantuml at position 27719...
Evaluation of this plantuml code block is disabled.
org-babel-exp process plantuml at position 27762...
Evaluation of this plantuml code block is disabled.


But those blocks don't have any special header:

#+begin_src plantuml :file tryout.png
...misc plantuml code here.
#+end_src


Can anyone offer suggestions why it reports scanning 22 files, and how to speed 
it up since no code should be evaluated?

Thank you,

  -k.



Re: Possible fix for :includes header argument in org-babel C source blocks

2020-05-27 Thread Kévin Le Gouguec
Hi,

Bastien  writes:

> Brandon Guttersohn  writes:
>
>> Hey all, I think I may have a small fix for executing C source blocks
>> in org-babel. Or, possibly just a bad case of user error.
>>
>> The issue (in emacs 27 with -q) is that it doesn't seem possible to
>> specify non-system header files with the :includes header argument.
>>
>> [...]
>>
>> The attached patch will wrap filenames in quotes if they do not begin
>> with "<", and works for me.
>
> Thanks for reporting this and for suggesting this patch, I think it is
> good enough.  I have applied it to the master branch of Org:
>
> https://code.orgmode.org/bzg/org-mode/commit/44cb98fdb6
>
> Best,

I think this commit might have broken test ob-C/string-var: running
"make test" on master (516c038e5) right now I get:

> Test ob-C/string-var condition:
> (wrong-type-argument sequencep )
>FAILED8/834  ob-C/string-var (0.004651 sec)

The following patch fixes the test:

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index c3e72c680..ae7b2ed1c 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -233,6 +233,7 @@ its header arguments."
 		;; includes
 		(mapconcat
 		 (lambda (inc)
+		   (when (symbolp inc) (setq inc (symbol-name inc)))
 		   (if (string-prefix-p "<" inc)
 		   (format "#include %s" inc)
 		 (format "#include \"%s\"" inc)))

I don't know if it's the best way forward; another way to make the test
pass is double-quoting "" and "" in ob-C-test.org:

diff --git a/testing/examples/ob-C-test.org b/testing/examples/ob-C-test.org
index 0faf630b9..efae02a19 100644
--- a/testing/examples/ob-C-test.org
+++ b/testing/examples/ob-C-test.org
@@ -38,7 +38,7 @@
 #+end_src
 
 #+source: string_var
-#+begin_src cpp :var q="word" :includes '( ) :results silent
+#+begin_src cpp :var q="word" :includes '("" "") :results silent
   std::cout << q << ' ' << std::strlen(q);
   return 0;
 #+end_src

I guess there might be some people out there who will expect things to
keep working without double-quotes?  I have never used Babel, so I have
no idea…

I hope this has not already been brought up; apologies if so.


[BUG] All drawers except property drawers are open at startup

2020-05-27 Thread Matt Lundin
All drawers default to open at startup except for property drawers. This
includes :LOGBOOK: drawers, which can be quite long and block view of an
entry.

I ran a git bisect and discovered that the bug was introduced with
commit 8b05c06d427e850d45684f69c5165cd7684e1071 on May 9. 

Matt



Re: Bug: ob-python mangles multiline :var values [9.3.6 (release_9.3.6-397-ga089600)]

2020-05-27 Thread Jack Kamm
Hi Matt --

> A heads up... I believe this changes the scope of the :var variables,
> since they previously were local to the main() function and now they are
> declared globally. After this change, some of my existing python source
> blocks (i.e., ones in which I attempt to assign a new value to a
> variable defined by :var) now generate the following error:
>
> Traceback (most recent call last):
>   File "", line 223, in 
>   File "", line 214, in main
> UnboundLocalError: local variable 'members' referenced before assignment

Thanks for noticing this and pointing it out. This was an oversight on
my end (I don't really use ":var" or non-session blocks).

Unfortunately, the fix for the original bug will have to be a bit more
complicated to avoid this error. I'll put it on my todo list, but if
anyone wants to have a crack at it, that would be very welcome.

We should also add a unit test for this regression so it doesn't happen
again.

> I hesitate to call this a bug, since it would be fine to think of
> everything within the source block as local and the header :var
> declarations as global.

I think it's fair to call this a bug. I think it would be inconvenient
to be unable to assign to these variables. Also, I did not intend to
break any existing code with this.

> And I suppose it would be worthwhile to ask: Is this change consistent
> with other org-babel modules? Is there a canonical way that org-babel
> handles scope?

IMO everything ought to be in the same scope, and the user shouldn't
have to think about the scope of the main() function that ob-python
wraps the body in. Especially since non-session blocks are evaluated
independently of other blocks, we really shouldn't have to think about
their scope.

I'm not sure if the Org manual provides any guidance here, but from a
quick check I didn't see anything about it.

Ideally I think everything should just be in global scope; however
ob-python needs to use a wrapper function for the "return" keyword.



org table: one column of random numbers (but natural ones)

2020-05-27 Thread Uwe Brauer
Hi


I have a org table and want to add a new colum, which natural numbers
which are randomly ordered 

So I tried 

#+TBLFM: $1=@#-1::$4=random($1@4);f1

But the column contains real numbers

What can I do

Uwe Brauer 




Re: issue tracker?

2020-05-27 Thread Eric Abrahamsen
Russell Adams  writes:

> On Wed, May 27, 2020 at 12:59:24PM -0500, Mario Frasca wrote:
>> myself, I recently posted a patch, received zero reaction, and have the
>> impression it's now lost in the logs of this mailing list.  indeed
>> pretty inefficient!
>
> Or the devs haven't had a chance yet.
>
>> something which flashed to my mind while writing this email: we're
>> dealing with an emacs software, part of emacs, can we just use M-x
>> report-emacs-bug?
>
> Yes, I believe that goes to the emacs bug list.

And if you put:

Package: org

As the first line in the report, it will automatically be tagged as org,
making it easier for people to find. (At least, I'm pretty sure that
will work correctly.)



Re: Bug: ob-python mangles multiline :var values [9.3.6 (release_9.3.6-397-ga089600)]

2020-05-27 Thread Matthew Lundin
Jack Kamm  writes:

> Hello,
>
> Thanks for reporting. I've just fixed this issue in master (commit
> 6149b6cb6).
>
> The problem was that ob-python adds tab indentation to the code body
> before putting it inside a main() function, which adds spurious
> indentation to multiline strings passed through :var.
>
> I fixed the issue by moving variable assignment from the code body to
> the code preamble, which is executed outside the main() function.

A heads up... I believe this changes the scope of the :var variables,
since they previously were local to the main() function and now they are
declared globally. After this change, some of my existing python source
blocks (i.e., ones in which I attempt to assign a new value to a
variable defined by :var) now generate the following error:

Traceback (most recent call last):
  File "", line 223, in 
  File "", line 214, in main
UnboundLocalError: local variable 'members' referenced before assignment

I hesitate to call this a bug, since it would be fine to think of
everything within the source block as local and the header :var
declarations as global. But if this is the case, then I think it should
be documented somewhere, especially since this change may break people's
existing source blocks. And I suppose it would be worthwhile to ask: Is
this change consistent with other org-babel modules? Is there a
canonical way that org-babel handles scope?

Best,

Matt



Re: issue tracker?

2020-05-27 Thread Russell Adams
On Wed, May 27, 2020 at 12:59:24PM -0500, Mario Frasca wrote:
> myself, I recently posted a patch, received zero reaction, and have the
> impression it's now lost in the logs of this mailing list.  indeed
> pretty inefficient!

Or the devs haven't had a chance yet.

> something which flashed to my mind while writing this email: we're
> dealing with an emacs software, part of emacs, can we just use M-x
> report-emacs-bug?

Yes, I believe that goes to the emacs bug list.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: issue tracker?

2020-05-27 Thread Mario Frasca
myself, I recently posted a patch, received zero reaction, and have the 
impression it's now lost in the logs of this mailing list.  indeed 
pretty inefficient!


something which flashed to my mind while writing this email: we're 
dealing with an emacs software, part of emacs, can we just use M-x 
report-emacs-bug?


cheers, MF

On 19/05/2020 09:58, Bruce D'Arcus wrote:
Regardless, doing issue tracking, discussion, and patch submission on 
a ML in 2020 is pretty odd and inefficient.


I would have submitted feedback here 6-12 months earlier than I did if 
org had a proper issue tracker.




Bug: 20200525 release: invalid function: org-preserve-local-variables [9.3.6 (9.3.6-75-gb614ed-elpa @ /home/jgoerzen/.emacs.d/elpa/org-20200525/)]

2020-05-27 Thread John Goerzen



Hello,

First of all, THANKS for org-mode!  I have been using it for several
years, and it's fantastic.

I recently have upgraded to org 20200525 from your package repo because
org-roam requires a newer org-mode than I had.  GNU ELPA has 9.3.6,
which would be new enough, but all of my machines fail downloading the
tar of that version from ELPA with "invalid request", so I'm on
20200525.

Many actions, and in particular refile, produce:

Invalid function: org-preserve-local-variables

and fail.

(org-refile) is defined in org.el but why it doesn't seem to be seeing
org-macs is beyond me.

Emacs  : GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-22, modified by Debian
Package: Org mode version 9.3.6 (9.3.6-75-gb614ed-elpa @ 
/home/jgoerzen/.emacs.d/elpa/org-20200525/)



Re: feature request: export only body of document for LaTeX & beamer

2020-05-27 Thread Eric S Fraga
On Wednesday, 27 May 2020 at 15:31, Nicolas Goaziou wrote:
> Isn't it what C-b is for in the export interface?

Why am I not surprised...  Yes, that looks like what I need/want!
Thank you.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-640-g9bc0cc



Re: feature request: export only body of document for LaTeX & beamer

2020-05-27 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> would it be possible to incorporate something along these lines in
> ox-latex.el (and ox-beamer.el):
>
> #+begin_src emacs-lisp
>   (defun headless-latex ()
> "exports to a .tex file without any preamble"
> (interactive)
> (org-latex-export-as-latex nil nil nil t nil)
> )
> #+end_src 

Isn't it what C-b is for in the export interface?

Regards,

-- 
Nicolas Goaziou



feature request: export only body of document for LaTeX & beamer

2020-05-27 Thread Eric S Fraga
Dear list,

would it be possible to incorporate something along these lines in
ox-latex.el (and ox-beamer.el):

#+begin_src emacs-lisp
  (defun headless-latex ()
"exports to a .tex file without any preamble"
(interactive)
(org-latex-export-as-latex nil nil nil t nil)
)
#+end_src 

[modified from snippet found on
https://stackoverflow.com/questions/8853312/how-can-i-make-org-mode-export-to-latex-with-a-specific-preamble
]

I find sometimes that I have to work with others on a LaTeX
document.  If I can, I prefer writing in org.  Being able to export just
the body of an org document to LaTeX makes it possible to use =\include=
in LaTeX to bring in the section I have written.  The code above will
create what I need but it exports to a buffer, not a file, and is not
accessible via the export interface.

It would be good to have this on C-c C-e l d (for document) and D (for
beamer equivalent) or similar (I'm not particular about actual binding).

My elisp-fu is not up to scratch for something like this.

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-640-g9bc0cc



Re: Improving Org Mode for VSCode - Thinking Aloud

2020-05-27 Thread Matt Price
There are a number of interesting topics here. Like others, I would be very
keen to share my org-based projects with non-Emacs users. I also only have
very limited time & skills to contribute.  There is an existing extension
for org-mode on vscode here:
https://github.com/vscode-org-mode/vscode-org-mode.  That might be the best
place to help out. One piece of low-hanging fruit would be simply to add an
HTML renderer to that plugin (https://github.com/orgapp/orgajs is the
obvious choice). A full-on literate programming engine seems like a very
tough thing to engineer, but perhaps it's possible to imagine a new
architecture in which there are, as you suggest, various code
interpretation engines. It's an exciting idea; I wonder if it's possible to
explore the possibilities in a more concrete and structured way?

On Sun, May 24, 2020 at 4:20 PM rey-coyrehourcq <
sebastien.rey-coyrehou...@univ-rouen.fr> wrote:

> Hi,
>
> Really cool discussion here.
>
> My two cents, Jupyter & Kernel on various langage, which have a very
> large community, could be an interesting backend for org-babel on
> VSCode or anyeditoryouwantusehere.
>
> Lot of things start to appear to collaborate online around
> online/scientific cnotebook/literate programing this last year, and that
> continue, for example i discover recently :
> Stencila : https://github.com/stencila=
>
> org-babel / org-mode outside of emacs has a great potential to lead an
> alternative to other markdown (RStudio / Jupyter) solution.
>
> Best regards
>
> Le dimanche 24 mai 2020 à 06:06 -0700, Jack Kamm a écrit :
> > It would be very good indeed for org-babel if it could be ported to
> > other editors. One of the biggest drawbacks of org-babel notebooks is
> > that I can't collaborate with my colleagues on them, since I can't
> > expect them to use Emacs.
> >
> > Aside from VSCode, I think RStudio would be an excellent target for a
> > few reasons:
> >
> > - Literate programming is already popular among R users (see also:
> >   knitr, sweave, Rmarkdown)
> > - There is a strong ob-R community here
> > - There are some prominent Emacs users among the Rstudio developers
> >   (e.g. Lionel Henry, who I think is both an Rstudio and ESS
> > developer)
> >
> > However, this would be a massive undertaking, and ultimately would
> > need
> > a volunteer to step up to the plate. I don't have any bandwidth to do
> > this in the foreseeable future but dream of working on it one day.
> > The
> > biggest downside -- it would require spending considerable time
> > outside
> > Emacs!
> >
> --
>
>
> Sébastien Rey-Coyrehourcq
> Research Engineer UMR IDEES
> 02.35.14.69.30
>
> {Stronger security for your email, follow EFF tutorial :
> https://ssd.eff.org/}
>
>
>


Re: How do I set attr_latex for the babel-block outputs?

2020-05-27 Thread Eric S Fraga
On Monday, 25 May 2020 at 12:47, Vladimir Nikishkin wrote:
> If I manually set #+attr_latex: :width 8cm above the #+RESULTS, it is
> displayed as expected, but If I recompute the picture, it is pasted
> above my manually added attr line.

Name your src block (using #+name:) and then the results block will also
be named and org babel will know where to place the new results.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-640-g9bc0cc



Re: Asynchronous LaTeX Preview

2020-05-27 Thread Martin Schöön
org-fragtog maybe?
https://github.com/io12/org-fragtog
(I have not managed to make it work myself but I haven't tried hard.)

/Martin

On Wed, 27 May 2020 at 08:21, Faye Jackson 
wrote:

> Hi!
>
> I think the subject of the post says it all. While using org-mode I often
> have a lot of LaTeX fragments scattered in my documents for mathematics,
> and I typically use the startup functionality to load all those previews
> when a file is loaded.
>
> Due to this, I'd be really interested in seeing an option to make that
> process asynchronous, so that it doesn't block me while I'm trying to view
> a document. I looked into doing this using emacs-async and emacs advice,
> but the org-mode project is fairly complex and this seems like a feature
> that would be nice to include by default.
>
> Thanks,
>
> -- Fay


[Feature] add a new org-attach dispatcher command to offline save web page

2020-05-27 Thread stardiviner

I attached the patch.

I think this feature will be helpful for use who archive web page data usually
like me. To be more portable, I also added an defcustom option for other
external command. And use an if condition to detect whether external command
available, else warning user.

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

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  
From fcf78b5a5447ae81479e7839df001da659ede5e3 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Wed, 27 May 2020 17:42:24 +0800
Subject: [PATCH] * org-attach.el: add a new command to offline save web page

* lisp/org-attach.el (org-attach-url-offline): A new org-attach
dispatcher command to offline save web page to a single file.

* lisp/org-agenda.el (org-attach-url-offline-command): A customize
option to specify external command for offline save web page.

* lisp/org-attach.el (org-attach-offline-url-with-monolith): A command
invoke external command "monolith" to offline save web page.
---
 lisp/org-attach.el | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 57d1360fc..0d13e0da1 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -204,6 +204,8 @@ (defcustom org-attach-commands
  "Attach a file using symbolic-link method.")
 ((?u ?\C-u) org-attach-url
  "Attach a file from URL (downloading it).")
+((?U) org-attach-url-offline
+ "Attach an offline version of web page URL (use monolith).")
 ((?b) org-attach-buffer
  "Select a buffer and attach its contents to the task.")
 ((?n ?\C-n) org-attach-new
@@ -467,6 +469,27 @@ (defun org-attach-url (url)
   (let ((org-attach-method 'url))
 (org-attach-attach url)))
 
+(defun org-attach-url-offline (url)
+  (interactive "MURL of the web page be offline to attach: \n")
+  (let ((org-attach-method 'offline))
+(org-attach-attach url)))
+
+(defcustom org-attach-url-offline-command (executable-find "monolith")
+  "The command used to offline save web page."
+  :type 'string
+  :safe #'stringp
+  :group 'org-attach)
+
+(defun org-attach-offline-url-with-monolith (url target-file)
+  "Save an offline archive of web page with monolith."
+  (if org-attach-url-offline-command
+  (make-process
+   :name "org-attach-offline"
+   :command (list org-attach-url-offline-command url "-o" target-file)
+   :sentinel (lambda (proc event) (message "org-attach-offline finished!"))
+   :buffer "*org-attach-offline*")
+(warn "You must have a command availble for offline save web page!\n Set variable `org-attach-url-offline-command'.")))
+
 (defun org-attach-buffer (buffer-name)
   "Attach BUFFER-NAME's contents to current outline node.
 BUFFER-NAME is a string.  Signals a `file-already-exists' error
@@ -504,7 +527,8 @@ (defun org-attach-attach (file  visit-dir method)
((eq method 'cp) (copy-file file attach-file))
((eq method 'ln) (add-name-to-file file attach-file))
((eq method 'lns) (make-symbolic-link file attach-file))
-   ((eq method 'url) (url-copy-file file attach-file)))
+   ((eq method 'url) (url-copy-file file attach-file))
+   ((eq method 'offline) (org-attach-offline-url-with-monolith file attach-file)))
   (run-hook-with-args 'org-attach-after-change-hook attach-dir)
   (org-attach-tag)
   (cond ((eq org-attach-store-link-p 'attached)
-- 
2.26.2



signature.asc
Description: PGP signature


Regression from 9.3 to 9.3.6: newlines getting swallowed on org-capture

2020-05-27 Thread Kevin Liu
This old thread describes similar behavior: 
https://emacs.stackexchange.com/questions/37097/newlines-swallowed-by-org-capture

Basically, the last position in the narrowed org-capture is actually the first 
position on the next line, so when you go to (end-of-buffer) and start typing 
you start clobbering the next headline.

I tested this with emacs -Q, capturing an `entry` with `file+headline` in org 
9.3 and it was working as expected, then in that same session loaded 9.3.6 and 
the capture buffer was one character longer (the added newline at the end) 
enabling the clobbering behavior.



Bug: ox-html.el: Code blocks extend out of box border

2020-05-27 Thread Seshal Jain
The exported html from Org Mode contains a style for element pre.src,
overflow: visible. This causes code elements with reasonably
long lines to extend out of the box boundaries, causing a horizontal
scroll of the document.
Changing overflow: visible to overflow: auto
should solve this, making the pre element scrollable instead and keeping the
code from leaking into the page and causing a horizontal scroll on the
document.


Asynchronous LaTeX Preview

2020-05-27 Thread Faye Jackson
Hi!

I think the subject of the post says it all. While using org-mode I often have 
a lot of LaTeX fragments scattered in my documents for mathematics, and I 
typically use the startup functionality to load all those previews when a file 
is loaded.

Due to this, I'd be really interested in seeing an option to make that process 
asynchronous, so that it doesn't block me while I'm trying to view a document. 
I looked into doing this using emacs-async and emacs advice, but the org-mode 
project is fairly complex and this seems like a feature that would be nice to 
include by default.

Thanks,

-- Faye