[O] Bug in org-lob: Function call adds space to argument string with parenthesis
* Bug in org-lob: Function call adds space to argument string with parenthesis Dear all, Please see the following code. I would expect arg="()" as result of the call-line but the result is arg="() " with an additional space. #+NAME: test #+BEGIN_SRC emacs-lisp :var arg="" (message "arg=%S" arg) #+END_SRC #+RESULTS: : arg="" #+call: test(arg="()") #+RESULTS: : arg="() " * My current fast and dirty hack is using sexps instead of regular expressions: #+BEGIN_SRC emacs-lisp (require 'ob-lob) (defadvice org-babel-lob-get-info (around correct-args activate) "Return a Library of Babel function call as a list. 1st element is the function call as a string. 2nd element is the indentation width 3rd element is the name of the function call if this call is named." (setq ad-return-value (let ((case-fold-search t) (nonempty (lambda (a b) (let ((it (match-string a))) (if (= (length it) 0) (match-string b) it) (save-excursion (beginning-of-line 1) (when (looking-at org-babel-lob-one-liner-regexp) (append (list (if (= (length (match-string 12)) 0) (org-babel-lob-get-info-call-line) (org-babel-lob-get-info-inline))) (list (length (if (= (length (match-string 12)) 0) (match-string 2) (match-string 11))) (save-excursion (forward-line -1) (and (looking-at (concat org-babel-src-name-regexp "\\([^\n]*\\)$")) (org-no-properties (match-string 1))) (defun org-babel-lob-get-info-call-line () "Unify Library of Babel call string of form \"#+CALL:\" The unified syntax is ,,#+CALL: []() " (save-excursion (save-match-data (let ((name "") (inside-header-args "[]") (args "()") end-header-args) (skip-syntax-forward " ") (unless (looking-at "#\\+call:[[:space:]]+\\(\\(?:\\sw\\|\\s_\\)+\\)") (error "Expecting #+CALL: at beginning of line")) (setq name (match-string 1)) (goto-char (match-end 0)) (skip-syntax-forward " ") (when (eq (char-after) ?\[) ;; inside-header-args (setq inside-header-args (buffer-substring-no-properties (point) (goto-char (scan-sexps (point) 1) (skip-syntax-forward " ") (when (eq (char-after) ?\() (setq args (buffer-substring-no-properties (point) (goto-char (scan-sexps (point) 1) (setq end-header-args (buffer-substring-no-properties (point) (line-end-position))) (concat name inside-header-args args end-header-args) (defun org-babel-lob-get-info-inline () "Transform one-line Library of Babel calls of form call_[]()[] into the unified syntax ,,#+CALL: []() " (save-excursion (save-match-data (let ((name "") (inside-header-args "[]") (args "()") (end-header-args "")) (skip-syntax-forward " ") (unless (looking-at "call_\\(\\(?:\\sw\\|\\s_\\)+\\)") (error "Expecting #+CALL: at beginning of line")) (setq name (match-string 1)) (goto-char (match-end 0)) (skip-syntax-forward " ") (when (eq (char-after) ?\[) ;; inside-header-args (setq inside-header-args (buffer-substring-no-properties (point) (goto-char (scan-sexps (point) 1) (skip-syntax-forward " ") (when (eq (char-after) ?\() (setq args (buffer-substring-no-properties (point) (goto-char (scan-sexps (point) 1) (when (eq (char-after) ?\[) (setq end-header-args (buffer-substring-no-properties (1+ (point)) (1- (scan-sexps (point) 1)
[O] Bug: Strange C-o behavior in Org-Mode [7.8.11]
* Strange C-o behavior in Org-Mode ** VERSION INFO I am using ErgoEmacs. I cannot tell whether this behavior is due to ErgoEmacs or Org-Mode. GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-28 on MARVIN ErgoEmacs distribution 2.0.0 ** PROBLEM DESCRIPTION Intermittently, C-o will alter its normal behavior. Normally, C-o opens a new blank line. This is apparently what it does for everyone. Occasionally, however, C-o behaves differently. 1. If C-o is executed at the beginning of a line, it pastes a one-line text string and adds a newline at the end 2. If C-o is executed anywhere else, it behaves normally. I suspect the text string is a single line I've previously grabbed with C-k. However, I cannot consistently reproduce via this method. IIRC, the text string is always a recent, familiar piece of text, possibly from the same file. Moreover, this behavior is limited to a single .org file. When one .org file is affected, other .org files do not exhibit the behavior. I do not THINK the behavior occurs except in org-mode, although since I almost always am using org-mode when using Emacs, I cannot say for sure. As a result, once a .org file is "bugged", I have to either avoid using C-o, or kill the unwanted text string every time it appears. A quick search of my .emacs file for "C-o" turns up nothing. I don't recall ever deliberately fiddling with such a setting. ErgoEmacs does generate a lot of funky keybinds. However, I have disabled those, and in any case ErgoEmacs wants C-o to replace C-x C-f, which is unrelated to my problem. I realize that this is not an ideal bug report. I am a non-technical user, and cannot reliably reproduce the bug anyway. Call this a shot in the dark. ** SOLUTION Refreshing org-mode with M-x org-mode eliminates the problem. I just discovered this easy fix, so it's not much of a nuisance anymore. Still, I'm curious, and this is already written! Emacs : GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-28 on MARVIN ErgoEmacs distribution 2.0.0 Package: Org-mode version 7.8.11 current state: == (setq org-export-blocks '((src org-babel-exp-src-block nil) (export-comment org-export-blocks-format-comment t) (ditaa org-export-blocks-format-ditaa nil) (dot org-export-blocks-format-dot nil)) org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe) org-src-fontify-natively t org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code) org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-agenda-custom-commands '(("x" "Agenda sorted by priority first" agenda "" ((org-agenda-sorting-strategy (quote (priority-up)) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook) org-babel-pre-tangle-hook '(save-buffer) org-occur-hook '(org-first-headline-recenter) org-export-interblocks '((src org-babel-exp-non-block-elements)) org-metaup-hook '(org-babel-load-in-session-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-catch-invisible-edits t org-export-latex-format-toc-function 'org-export-latex-format-toc-default org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-export-first-hook '(org-beamer-initialize-open-trackers) org-mode-hook '(er/add-org-mode-expansions #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5] #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes soft-wrap-lines) org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc org-beamer-auto-fragile-frames org-beamer-place-default-actions-for-lists) org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars) org-metadown-hook '(org-babel-pop-to-session-maybe) 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-confirm-shell-link-function 'yes-or-no-p )
Re: [O] Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa /home/pillow/.emacs.d/elpa/org-20151123/)]
Hi Robert, Thanks for the reply but my end goal is to insert the contents of another file as the preamble. Ultimately, I want something like this: (insert-file-contents "~/Blog/html/preamble.html") To be inserted as the preamble. Your example works unmodified but once I try to insert the contents of my preamble.html it doesn't get included. I tried: (defun my-html-preamble (options) (insert-file-contents "~/Blog/html/preamble.html")) but this does not include my preamble.html. As far as I could tell from the documentation :html-preamble should accept any function that returns a string but so far no luck. Kind regards, pillow.
Re: [O] CDlatex
Hi Nick, You are correct it is still there, but I can’t start cdlatex-mode via the org-mode-hook (i.e., include add-hook 'org-mode-hook 'turn-on-org-cdlatex in my .emacs file). It only works when it type M-x cdlatex-mode in the buffer. Maybe it is clashing with something. Best wishes, M
Re: [O] How to display full paths in agenda?
On 2015-12-19, at 16:13, Nick Dokos wrote: > Probably %b in org-agenda-prefix-format. Many thanks, that's it!!! Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University
Re: [O] How to enter a tag when capturing?
On Sa, 2015-12-19 at 16:48, Marcin Borkowski wrote: > I'd like to insert a tag while capturing an item. Of course, C-c C-c > finishes capture. I can insert the tag manually (and currently I'm > doing just that), but is there a better way? C-c C-q bound to org-set-tags-command. -- Michael Strey http://www.strey.biz * https://twitter.com/michaelstrey
Re: [O] How to enter a tag when capturing?
Marcin Borkowski writes: > Hi list, > > I'd like to insert a tag while capturing an item. Of course, C-c C-c > finishes capture. I can insert the tag manually (and currently I'm > doing just that), but is there a better way? > Not quite sure what you mean: do you want it to be part of the template? Otherwise, C-c C-q works in the capture buffer: is that enough? -- Nick
[O] How to enter a tag when capturing?
Hi list, I'd like to insert a tag while capturing an item. Of course, C-c C-c finishes capture. I can insert the tag manually (and currently I'm doing just that), but is there a better way? TIA, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University
Re: [O] [RFC] Removal of [1]-like footnotes
I vote "yes". It was annoying to see bracketed numbers as links to nowhere. The Nobel prize for the detection of the neutrino [1995] was Frederick Reines and the prizes for the discovery of neutrino oscillations [2015] were Takaaki Kajita & Arthur McDonald. The resulting sets are [1,2,3], [1,2], [1] Le 17/12/2015 11:03, Nicolas Goaziou a écrit : Hello, As discussed previously, I pushed changes about footnotes in a dedicated branch, "wip-no-plain-fn", for testing. In a nutshell, in this branch, Org no longer recognizes [1]-like constructs as valid footnotes, an no longer spend time matching them. As a consequence, "fn:" can now be unambiguously removed from label and become part of the syntax. Thus, [fn:1] is labelled "1" and [fn:label] is labelled "label".
Re: [O] How to display full paths in agenda?
Marcin Borkowski writes: > On 2015-12-19, at 03:27, Eric Abrahamsen wrote: > >> Marcin Borkowski writes: >> >>> Hi all, >>> >>> I'm pretty sure I read somewhere about a possibility to display not only >>> the headlines, but the full paths in the agenda, so that >>> >>> * aaa >>> ** bbb >>> >>> is displayed as `aaa/bbb' and not as `aaa' (or something like that). >>> I can't find it anywhere, though. Any hints? >>> >>> TIA, >> >> You can set org-agenda-show-outline-path' to show the path in the echo >> area. > > Thanks, though I knew about this, have this on, and it's not what > I meant. > I posted a reply but I guess it was lost, so I'm trying again: Probably %b in org-agenda-prefix-format. -- Nick
[O] An Experiment: Wikipedia to Org
I am working on an html to org exporter. As an experiment, I tried passing a Wikipedia article to it. Here is an HTML snippet. . [ 8 ] Here is the corresponding Org translation. .^{[[cite_note-FOOTNOTEGethin199827.E2.80.9328.2C_73.E2.80.9374-10][[8]]]} My question is, GIVEN the above Org-snippet would it possible to improve the `org-element-parse-buffer' so that it's output matches with the HTML input. Just an experiment ...What do you think?
[O] `ob-babel-expand-noweb-references' does not take into account `org-babel-tangle-uncomment-comments'
Hello, I would like the tangle functionality of org-mode to generate line directives so that compilers generate correct location for errors. I am using the following settings, using the `:comments' feature of tangle: ;; Do not comment comments (setq org-babel-tangle-uncomment-comments t) ;; Beginning: set line directives (this is for OCaml) (setq org-babel-tangle-comment-format-beg "# %start-line \"%file\"\n") ;; No end template [Remember that they are not commented] (setq org-babel-tangle-comment-format-end " ") This works surprsingly well for ordinary code blocks but breaks down when noweb is used. Indeed control is passed to ob-babel-expand-noweb-references which comments the "comment" (I see this can be confusing) because it ignores the setting. My question is: is this the indented behaviour? Also, I do think such a behaviour should be supported out of the box: this is very important for compiled languages. Best wishes, Simon.
Re: [O] How to display full paths in agenda?
On 2015-12-19, at 03:27, Eric Abrahamsen wrote: > Marcin Borkowski writes: > >> Hi all, >> >> I'm pretty sure I read somewhere about a possibility to display not only >> the headlines, but the full paths in the agenda, so that >> >> * aaa >> ** bbb >> >> is displayed as `aaa/bbb' and not as `aaa' (or something like that). >> I can't find it anywhere, though. Any hints? >> >> TIA, > > You can set org-agenda-show-outline-path' to show the path in the echo > area. Thanks, though I knew about this, have this on, and it's not what I meant. Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University