[BUG] org parser error [9.6.1 (9.6.1-g351279 @ /home/mah/.emacs.d/straight/build/org/)]
Loading the following file with "emacs -Q", I'm un-able to type 'C-c C-c' in the source block to execute it. #+begin_src elisp (defun count-lines (dir) "Number of lines in *.php files in a DIR." (let ((extdir (concat "../mediawiki/extensions/" dir))) (if (not (f-directory-p extdir)) "" (let ((files (directory-files-recursively extdir "\\.php$")) (count 0)) (dolist (file files) (setq count (+ count (-reduce '+ (mapcar 'file-lines (list file)) count #+end_src When I do the following error appears: ⛔ Warning (org-element-cache): org-element--cache: Org parser error in tmp.org::4740. Resetting. The error was: (wrong-number-of-arguments (lambda (dir) "Number of lines in *.php files in a DIR." (let ((extdir (concat "../mediawiki/extensions/" dir))) (if (not (f-directory-p extdir)) "" (let ((files (directory-files-recursively extdir "\\.php$")) (count 0)) (dolist (file files) (setq count (+ count (-reduce '+ (mapcar 'file-lines (list file)) count 2) Backtrace: nil Please report this to Org mode mailing list (M-x org-submit-bug-report). Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.16.0) of 2023-02-23 Package: Org mode version 9.6.1 (9.6.1-g351279 @ /home/mah/.emacs.d/straight/build/org/)
Re: Supporting non-free SQL clients in ob-sql (was: [PATCH] ob-sql: Add support for Athena)
> > 3. There is no requirement to install non-free software to use > > ob-sql.el. The software is fully functional using a free RDMS like > > postgres. > Yes, but there is requirement to install in order to use ob-sql.el > __with :engine set to non-free option__. Do you mean, "to use ob-sql.el with nonfree program Foo, there is a requirement to install Foo"? I think so. That's true, but it's not a problem. That's not what we mean when we say "a requirement to install nonfree software." -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)
Have export treat file: paths in INCLUDED file relative to the INCLUDING file's dir
Hello, I have a file s.org in ./ (current directory), which includes another file s0.org living under ./media/s/: ./s.org: #+TITLE: s #+INCLUDE: "./media/s/s0.org" ./media/s/s0.org: * s0 ** s01 file:media/s01_image.png I want the org export to html to treat the file: paths in ./media/s/s0.org with respect to the directory of the ./s.org file. In other words, I want export NOT TO TOUCH the file: paths as written included files and effectively just paste the text of s0.org verbatim in s.org (basically similar to what #include directive in C preprocessor would do, e.g.). As of now, the above s.org exports to s.html which has the file: link converted to file:///home/user/media/s/media/s01_image.png I want that link to instead become file:///home/user/media/s01_image.png which used to be the default behavior in a previous version of Org mode (I don't recall which one). Is there a flag that could be passed to #+INCLUDE: to change the 'relativeness' of the link treatment when it comes to #+INCLUDE: directives? I see in ox.el, (defun org-export-expand-include-keyword ( included dir footnotes) "Expand every include keyword in buffer. Optional argument INCLUDED is a list of included file names along with their line restriction, when appropriate. It is used to avoid infinite recursion. Optional argument DIR is the current working directory. It is used to properly resolve relative paths. Optional argument FOOTNOTES is a hash-table used for storing and resolving footnotes. It is created automatically." Is this DIR what's needed (to be given to #+INCLUDE: with a flag) to change the link translation behavior? Org mode version 9.4.4 (release_9.4.4) GNU Emacs 27.2 Thanks, Omid
Re: Key binding in help (was: Re: PROPOSAL: Bind `org-fold-hide-subtree' by default in Org Mode.)
what i meant was that i have a binding, org-next-link, bound to c-tab. i acccomplished this with (define-key org-mode-map (quote [C-tab]) (quote org-next-link)) [kbd would be better]. i did similar with org-link-minor-mode. i was just offtopicing that it would be useful to jump to those definitions. i.e. like m-. on a function name, if that is set up to work, or c-h f command tab ret to go to the fuction definition, but for keys. On 2/25/23, Max Nikulin wrote: > On 23/02/2023 11:48, Samuel Wales wrote: >> huh i had put org-next-link there. i wish define-key could have a >> button in a help page like functions and vars do so you could go to >> where you define it. [there are probably 300 competing packages that >> do exactly that.] > > C-h f org-next-link > > displays at the top: > > It is bound to C-c C-x C-n,. > > Is it the feature you are asking for? This one is available out of the box. > > Unfortunately it is not trivial to discover binding from a file that is > not loaded. Actually I found `tab-next' in the manual at first. Earlier > attempts with "C-" and "C-TAB" failed due to "[(control tab)]" is > used in tab-bar.el. > > > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com
Re: PROPOSAL: Bind `org-fold-hide-subtree' by default in Org Mode.
On 25 Feb 2023, Max Nikulin wrote: On 25/02/2023 07:13, Karl Fogel wrote: Okay, today I did some research and found that every "C-c C-" binding is used in Org Mode except for "C-c C-g". While that one is technically reserved for the mode's use No, there is an explicit exception for C-g, see (info "(elisp) Key Binding Conventions") in "Tips and Conventions" appendix. https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html Ah, thanks for pointing that out. Even C-c C-x prefix is quite busy. Other modifiers might be a rescue: C-c M-something. However perhaps M-x with fuzzy completion allowing typos (and ideally synonyms) might be a better solution. Well, sure -- we get that for free. I think we can consider this proposal over. While I find `org-fold-hide-subtree' very useful, the Org Mode default keyspace is very busy already, and we don't hear anyone proposing to drop something else in favor of `org-fold-hide-subtree'. Anyone can custom-bind it themselves, of course (which is what I'll continue doing). No, [Ctrl+Tab] and [Ctrl+Shift+Tab] is widely used in other applications to switch to next/previous tabs. I would strongly prefer to keep it consistent across as much applications as possible. (There are corner cases like e.g. vim with multiple tabs running in a terminal application having several tabs as well. E.g. gnome terminal is able to pass [Ctrl+PgDn], a [Ctrl+Tab] alternative, while it has single tab, but intercepts the same shortcut when more terminal tabs are opened, so vim keys have to be used.) Agreed. Best regards, -Karl
Re: Hiding citations
Am Samstag, dem 25. Februar 2023 schrieb Bruce D'Arcus: > Not exactly what you're asking for, but have you seen this activate processor? > > https://github.com/andras-simonyi/org-cite-csl-activate Not yet, and it certainly looks nice, but the CSL style I use uses footnotes, and those are quite verbose. Rendering them (or rather, their content) into the text would expand it even more. -quintus -- Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite Passau, Deutschland | kont...@guelker.eu| O<
Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks
Hi Max, On 2023-02-25 at 08:05 -08, Max Nikulin wrote: > I believe, it is safer to define > `org-babel-variable-assignments:screen' some way: alias, substitution, > function that calls `org-babel-variable-assignments:shell'. I am > unsure which variant is better. I see a couple of callers for specific > language in ob-core.el. How's this with a defalias? -k. >From f7ca0258d72b3da5743b1134718b1d1f0d74491d Mon Sep 17 00:00:00 2001 From: "Kenneth D. Mankoff" Date: Mon, 20 Feb 2023 21:40:39 -0800 Subject: [PATCH] lisp/ob-screen.el: Support var header args for babel blocks * ob-screen.el: (org-babel-execute:screen): Parse header params for `:var', then inject into screen session. * etc/ORG-NEWS: Document as New Feature --- etc/ORG-NEWS | 12 lisp/ob-screen.el | 8 2 files changed, 20 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87ecd77cd..0da686354 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -106,6 +106,18 @@ selection. TODO state, priority, tags, statistics cookies, and COMMENT keywords are allowed in the tree structure. +*** ob-screen now supports :var header arguments + +The ~:var~ header arg is now supported. + +#+BEGIN_src org +,#+BEGIN_SRC screen :var x=42 +,echo $x +,#+END_SRC +#+END_src + + + * Version 9.6 ** Important announcements and breaking changes diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el index 269538e79..6e6a31ea6 100644 --- a/lisp/ob-screen.el +++ b/lisp/ob-screen.el @@ -40,6 +40,10 @@ (require 'ob) +;; Reuse the variable assignment code from ob-shell +(defalias 'org-babel-variable-assignments:screen + 'org-babel-variable-assignments:shell) + (defvar org-babel-screen-location "screen" "The command location for screen. In case you want to use a different screen than one selected by your $PATH") @@ -55,8 +59,12 @@ In case you want to use a different screen than one selected by your $PATH") (message "Sending source code block to interactive terminal session...") (save-window-excursion (let* ((session (cdr (assq :session params))) + (var-lines (org-babel-variable-assignments:screen params)) (socket (org-babel-screen-session-socketname session))) (unless socket (org-babel-prep-session:screen session params)) + (mapcar (lambda (var) +(org-babel-screen-session-execute-string session var)) + var-lines) (org-babel-screen-session-execute-string session (org-babel-expand-body:generic body params) -- 2.34.1
Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks
On 25/02/2023 22:14, Ken Mankoff wrote: On 2023-02-24 at 19:51 -08, Max Nikulin wrote: The code still depends on on ob-shell. Is there a reason why calling `org-babel-variable-assignments:shell' is a worse variant than copy of the whole function body? I didn't realize that was a dependency. I now use that function. This also means that arrays/tables/etc. are all supported by :var, although not in the default screen ":cmd sh" because sh doesn't support "declare", but it works with ":cmd bash". + (var-lines (org-babel-variable-assignments:shell params)) (socket (org-babel-screen-session-socketname session))) I believe, it is safer to define `org-babel-variable-assignments:screen' some way: alias, substitution, function that calls `org-babel-variable-assignments:shell'. I am unsure which variant is better. I see a couple of callers for specific language in ob-core.el. I can not suggest anything specific concerning sh vs. bash. I have never tried to pass tables to sh src blocks.
Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks
I note that `org-babel-screen-test` fails, but it appears to fail before this change too... -k. On Sat, Feb 25, 2023 at 7:14 AM Ken Mankoff wrote: > Hi Max, > > On 2023-02-24 at 19:51 -08, Max Nikulin wrote: > > On 25/02/2023 01:33, Ken Mankoff wrote: > > I am unsure if Org markup is suitable for commit messages (~:var~) > > since it may appear in Emacs commit logs. > > Fixed. > > > The code still depends on on ob-shell. Is there a reason why calling > > `org-babel-variable-assignments:shell' is a worse variant than copy of > > the whole function body? > > I didn't realize that was a dependency. I now use that function. This also > means that arrays/tables/etc. are all supported by :var, although not in > the default screen ":cmd sh" because sh doesn't support "declare", but it > works with ":cmd bash". > > Improved patch attached. > > Thanks, > > -k. > > > >
Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks
Hi Max, On 2023-02-24 at 19:51 -08, Max Nikulin wrote: > On 25/02/2023 01:33, Ken Mankoff wrote: > I am unsure if Org markup is suitable for commit messages (~:var~) > since it may appear in Emacs commit logs. Fixed. > The code still depends on on ob-shell. Is there a reason why calling > `org-babel-variable-assignments:shell' is a worse variant than copy of > the whole function body? I didn't realize that was a dependency. I now use that function. This also means that arrays/tables/etc. are all supported by :var, although not in the default screen ":cmd sh" because sh doesn't support "declare", but it works with ":cmd bash". Improved patch attached. Thanks, -k. >From 580499925644cdb9c2dd8c783ec03c095bec7a86 Mon Sep 17 00:00:00 2001 From: "Kenneth D. Mankoff" Date: Mon, 20 Feb 2023 21:40:39 -0800 Subject: [PATCH] lisp/ob-screen.el: Support var header args for babel blocks * ob-screen.el: (org-babel-execute:screen): Parse header params for `:var', then inject into screen session. * etc/ORG-NEWS: Document as New Feature --- etc/ORG-NEWS | 12 lisp/ob-screen.el | 4 2 files changed, 16 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87ecd77cd..0da686354 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -106,6 +106,18 @@ selection. TODO state, priority, tags, statistics cookies, and COMMENT keywords are allowed in the tree structure. +*** ob-screen now supports :var header arguments + +The ~:var~ header arg is now supported. + +#+BEGIN_src org +,#+BEGIN_SRC screen :var x=42 +,echo $x +,#+END_SRC +#+END_src + + + * Version 9.6 ** Important announcements and breaking changes diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el index 269538e79..bd8650f6b 100644 --- a/lisp/ob-screen.el +++ b/lisp/ob-screen.el @@ -55,8 +55,12 @@ In case you want to use a different screen than one selected by your $PATH") (message "Sending source code block to interactive terminal session...") (save-window-excursion (let* ((session (cdr (assq :session params))) + (var-lines (org-babel-variable-assignments:shell params)) (socket (org-babel-screen-session-socketname session))) (unless socket (org-babel-prep-session:screen session params)) + (mapcar (lambda (var) +(org-babel-screen-session-execute-string session var)) + var-lines) (org-babel-screen-session-execute-string session (org-babel-expand-body:generic body params) -- 2.34.1
Hiding citations
Dear list, is there a way to visually hide citations in the org buffer, much like links are hidden? I ask because if a text passage contains a number of citations, it quickly becomes hard to read if they are all displayed in raw format. Here is a paragraph from one of my recently published papers[1] in its original org markup (language is German): > Der Begriff „Überwachungsgesamtrechnung“ wurde von > {{{name(Roßnagel)}}} im Anschluss an die Entscheidung des > {{{court(BVerfG)}}} zur Vorratsdatenspeicherung geprägt. > [cite:@roßnagel2010überwgesrech p. 1242,] Er sieht in der Passage, in > der das {{{court(BVerfG)}}} den Gesetzgeber „in Blick auf die > Gesamtheit der verschiedenen schon vorhandenen Datensammlungen zu > größerer Zurückhaltung“ [cite:@bverfg2010vds p. 324,] anhält, den > Ausgangspunkt für eine doppelte Verhältnismäßigkeitsprüfung, die > einmal individuell und einmal gesamtgesellschaftlich anhand aller > bestehenden Überwachungsmaßnahmen in Gesamtschau ausgeführt werden > müsse. [cite: @roßnagel2010überwgesrech p. 1240,;dem folgend > @braun-albrecht2017freih_gasse p. 152,;kritisch dazu > @hornung-schnabel2010bverfgvds p. 827,] Eine solche doppelte > Verhältnismäßigkeitsprüfung hat das {{{court(BVerfG)}}} aber weder in > dieser noch in einer anderen Entscheidung durchgeführt. Anderes folgt > auch nicht aus dem gelegentlichen Rekurs des Gerichts auf eine „große > Streubreite“. Soweit das {{{court(BVerfG)}}} hierauf zurückgreift, > wird der Begriff ausschließlich zur Begründung einer hohen > Eingriffsintensität genutzt, [cite:Vgl. @bverfg2005vorbeug_telek p. > 383,;@bverfg2010vds p. 318,;@bverfg2018kfz_kennz_ii note 98,] d. h. > die „große Streubreite“ erhöht die Anforderungen an die später zu > prüfende Angemessenheit. Eine doppelte Verhältnismäßigkeitsprüfung ist > damit nicht verbunden. I use visual-line-mode, so imagine this actually as a single long line. It contains both macros (which can nicely be condensed with `org-hide-macro-markers' to improve readability), but some of those citation constructs are awkwardly long and hinder reading the paragraph as a whole in the editor, most notably the one with the three citations right in the middle. I would prefer it it looked like this: > Der Begriff „Überwachungsgesamtrechnung“ wurde von name(Roßnagel) im > Anschluss an die Entscheidung des court(BVerfG) zur > Vorratsdatenspeicherung geprägt. [cite:…] Er sieht in der Passage, in > der das court(BVerfG) den Gesetzgeber „in Blick auf die Gesamtheit der > verschiedenen schon vorhandenen Datensammlungen zu größerer > Zurückhaltung“ [cite:…] anhält, den Ausgangspunkt für eine doppelte > Verhältnismäßigkeitsprüfung, die einmal individuell und einmal > gesamtgesellschaftlich anhand aller bestehenden Überwachungsmaßnahmen > in Gesamtschau ausgeführt werden müsse. [cite:…] Eine solche doppelte > Verhältnismäßigkeitsprüfung hat das court(BVerfG) aber weder in dieser > noch in einer anderen Entscheidung durchgeführt. Anderes folgt auch > nicht aus dem gelegentlichen Rekurs des Gerichts auf eine „große > Streubreite“. Soweit das court(BVerfG) hierauf zurückgreift, wird der > Begriff ausschließlich zur Begründung einer hohen Eingriffsintensität > genutzt, [cite:…] d. h. die „große Streubreite“ erhöht die > Anforderungen an die später zu prüfende Angemessenheit. Eine doppelte > Verhältnismäßigkeitsprüfung ist damit nicht verbunden. This is much more easier to look at and uses the spare screen space in a much more economic way. Editing citations could follow the same rules as editing links, that is, if the terminal bracket is removed, everything becomes visible again (or one just uses special citation-editing commands). Does such a feature already exist? If not, I would like to request it. I however do think that it should be optional, because there is some useful information inside the citation constructs that might help reading (and not everyone needs so many and long citation constructs as my discipline). -quintus [1]: Contained in this open-access conference proceedings volume: https://cloud.weizenbaum-institut.de/s/kEyydT72PSSpjSo -- Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite Passau, Deutschland | kont...@guelker.eu| O<
Re: Hiding citations
On Sat, Feb 25, 2023 at 7:31 AM M. ‘quintus’ Gülker wrote: > is there a way to visually hide citations in the org buffer, much like > links are hidden? Not exactly what you're asking for, but have you seen this activate processor? https://github.com/andras-simonyi/org-cite-csl-activate Bruce
Re: PROPOSAL: Bind `org-fold-hide-subtree' by default in Org Mode.
On 25/02/2023 07:13, Karl Fogel wrote: Okay, today I did some research and found that every "C-c C-" binding is used in Org Mode except for "C-c C-g". While that one is technically reserved for the mode's use No, there is an explicit exception for C-g, see (info "(elisp) Key Binding Conventions") in "Tips and Conventions" appendix. https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html (It's not clear to me whether Emacs's conventions consider "C-c C-i" to be a letter or whether they treat "C-i" as "TAB" and consider it special; based on the previous evidence in this thread, maybe the latter, so we shouldn't consider "C-c C-i" to be available.) It might be a problem to distinguish C-i and in text terminal. Issues with "C-c C-," raised on this list - (info "(emacs) Named ASCII Chars") https://www.gnu.org/software/emacs/manual/html_node/emacs/Named-ASCII-Chars.html - (info "(elisp) Function Keys") https://www.gnu.org/software/emacs/manual/html_node/elisp/Function-Keys.html A similar issue exists with C-S-letter - (info "(emacs) Modifier Keys") https://www.gnu.org/software/emacs/manual/html_node/emacs/Modifier-Keys.html - (info "(elisp) Other Char Bits") https://www.gnu.org/software/emacs/manual/html_node/elisp/Other-Char-Bits.html I think what this is telling me is that Org Mode keybinding real estate is quite valuable :-), Even C-c C-x prefix is quite busy. Other modifiers might be a rescue: C-c M-something. However perhaps M-x with fuzzy completion allowing typos (and ideally synonyms) might be a better solution. Are you saying that the only current default binding for C-=20 in Emacs is that one in tab-bar.el, and therefore we should feel=20 free to rebind it in Org Mode? No, [Ctrl+Tab] and [Ctrl+Shift+Tab] is widely used in other applications to switch to next/previous tabs. I would strongly prefer to keep it consistent across as much applications as possible. (There are corner cases like e.g. vim with multiple tabs running in a terminal application having several tabs as well. E.g. gnome terminal is able to pass [Ctrl+PgDn], a [Ctrl+Tab] alternative, while it has single tab, but intercepts the same shortcut when more terminal tabs are opened, so vim keys have to be used.)
Re: ox-rst still working?
Angel de Vicente writes: > Hello, > > I was trying to export an .org file to .rst. I have ox-rst 20200815.1511 > installed, and I have run (require 'ox-rst), but despite this, there is > no option for rsT in the Org Export Dispatcher. Did I miss something to > make it work? > Maybe this know issue, opened in 2017? https://github.com/msnoigrs/ox-rst/issues/35 Bruno
Re: Org-mode notes about school lessons
On 2023-02-24, at 18:05, Tory S. Anderson wrote: >> As I need to write a lot for each lesson, and each lesson are mostly >> independent from each other, I plan to have 1 file per lesson. > This is a very stylistic, but I am a "all in one file" user, though > I have a seperate directory and .org file per class, but no more split > than that. I have always had =C-c s= bound in org files to something > like =consult-org-heading= (or the helm equivalent, or selectrum > equivalent, or even the vanilla emacs equivalent that I can't remember > right now). To me, being able to easily go to headings/classes in one > file fits my usage. I could see arguments for the other, though, since > emacs is good at browsing/searching multiple files, too. And I suppose > git version control might be more useful on the multiple-file setup. This. To each his own, but I also can't see much benefit of having many small files instead of a few larger ones. For example, linking to other sections might be easier this way. But, as Tory said, this is also about personal preference, so I'm not claiming here that my way is objectively better. Best, -- Marcin Borkowski http://mbork.pl
Key binding in help (was: Re: PROPOSAL: Bind `org-fold-hide-subtree' by default in Org Mode.)
On 23/02/2023 11:48, Samuel Wales wrote: huh i had put org-next-link there. i wish define-key could have a button in a help page like functions and vars do so you could go to where you define it. [there are probably 300 competing packages that do exactly that.] C-h f org-next-link displays at the top: It is bound to C-c C-x C-n,. Is it the feature you are asking for? This one is available out of the box. Unfortunately it is not trivial to discover binding from a file that is not loaded. Actually I found `tab-next' in the manual at first. Earlier attempts with "C-" and "C-TAB" failed due to "[(control tab)]" is used in tab-bar.el.