Re: [O] Worg Tutorial error: using Emacs lisp as formulas
On 27/08/14 03:52, Nick Dokos wrote: Ciaran Mulloy writes: Hi! I was fascinated to work through the examples provided in the org-tutorials sections under Worg and really see the power of using eLisp as spreadsheet formula: http://orgmode.org/worg/ org-tutorials/org-spreadsheet-lisp-formulas.html However the use of the mapconcat function always generated an error: Invalid regex "Regular expression too big", even with only a few terms in the formula. The offending formula was: #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") I experimented with variations of the formula getting the same error every time. I did a search of the org-mode forum without finding any solution. Any thoughts? I can't reproduce it - e.g. this --8<---cut here---start->8--- | one | two | three | four | five | |-+-+---+--+--| | a | a | a b c e f d g | | | | a | b | | | | | b | a | | | | | c | d | | | | | e | f | | | | | f | g | | | | | a | f | | | | #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") --8<---cut here---end--->8--- works fine for me. This is with more-or-less latest org. Moreover, none of the functions used (mapconcat, identity, delete-dups or list) use regexps at all. There is a chance that regexps are used by the evaluator when building the ranges, but it's unlikely IMO, so the regexp error seems like a red herring to me. How big a table did you try? Did you try restarting emacs and redoing the evaluation? How about starting emacs without any of your customizations and redoing the evaluation? Something like this emacs -q -l /path/to/minimal/init /path/to/file/with/the/table where the minimal init file just sets load-path if necessary and initializes org. Hi Nick, Many thanks for your input. The table I was trying was the example in the tutorial shown as follows (not big) and no hint of a regex!: | Col1 | Col2 | Col3 | Col4 | Col5 | |--+--+--+--+--| | a| a| :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") | b| | | b| a| | | | | c| d| | | | #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") I did as you suggested and ran emacs -q -l ~/.emacs ~/path_to_file and got the same result as above: org-table-eval-formula: Invalid regexp: "Regular expression too big" The .emacs file is blank. The version of emacs is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, ) of 2013-07-27 on roseapple, modified by Debian Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/) Using Mint 17 Xfce. I don't think I'm doing something silly here but am at a loss to figure out the problem.
Re: [O] [PATCH] Make use of the constant `org-clock-string' whenever possible
Hi, Finally, I don't have time to dig into org-element.el for the time being. Nonetheless, please find attached a revised version of the patch with your comments taken into account. In order to avoid creating the regexp each time `org-at-clock-log-p' is called, I added the constant `org-clock-line-re', following the same naming convention as `org-planning-or-clock-line-re' defined above. From d0247756c9a9c8a753dfba6c2de0c4f1d9ed4fc5 Mon Sep 17 00:00:00 2001 From: Konubinix Date: Tue, 26 Aug 2014 09:11:23 +0200 Subject: [PATCH] [PATCH] Use `org-clock-string' whenever possible * lisp/org-clock.el (org-find-open-clocks): * lisp/org.el (org-clone-subtree-with-time-shift, org-insert-property-drawer, org-at-clock-log-p): Use `org-clock-string' whenever possible instead of hardcoded "CLOCK". Add the `org-clock-line-re' regexp matching a line with clock info. --- lisp/org-clock.el | 3 ++- lisp/org.el | 21 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 179d395..2ffcbfa 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -795,11 +795,12 @@ If CLOCK-SOUND is non-nil, it overrides `org-clock-sound'." "Search through the given file and find all open clocks." (let ((buf (or (get-file-buffer file) (find-file-noselect file))) + (org-clock-re (concat org-clock-string " \\(\\[.*?\\]\\)$")) clocks) (with-current-buffer buf (save-excursion (goto-char (point-min)) - (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t) + (while (re-search-forward org-clock-re nil t) (push (cons (copy-marker (match-end 1) t) (org-time-string-to-time (match-string 1))) clocks clocks)) diff --git a/lisp/org.el b/lisp/org.el index 750b9d1..2dd3e80 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -396,6 +396,10 @@ a timestamp with \\[org-schedule].") "Matches a line with planning or clock info. Matched keyword is in group 1.") +(defconst org-clock-line-re + (concat "^[ \t]*" org-clock-string) + "Matches a line with clock info.") + Drawer (defconst org-drawer-regexp "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$" @@ -8659,6 +8663,7 @@ and still retain the repeater to cover future instances of the task." ""))) ;; No time shift (n-no-remove -1) (drawer-re org-drawer-regexp) + (org-clock-re (format "^[ \t]*%s.*$" org-clock-string)) beg end template task idprop shift-n shift-what doshift nmin nmax) (if (not (and (integerp n) (> n 0))) @@ -8698,7 +8703,8 @@ and still retain the repeater to cover future instances of the task." (org-entry-delete nil "ID") (org-id-get-create t))) (unless (= n 0) - (while (re-search-forward "^[ \t]*CLOCK:.*$" nil t) + (while (re-search-forward + org-clock-re nil t) (kill-whole-line)) (goto-char (point-min)) (while (re-search-forward drawer-re nil t) @@ -15883,6 +15889,10 @@ formats in the current buffer." 0)) (beg (point)) (re (concat "^[ \t]*" org-keyword-time-regexp)) + (org-clock-re (format + "^[ \t]*\\(:CLOCK:\\|:LOGBOOK:\\|%s\\|:END:\\)" + org-clock-string)) + (org-skip-line-list (list org-clock-string ":END:")) end hiddenp) (outline-next-heading) (setq end (point)) @@ -15891,8 +15901,10 @@ formats in the current buffer." (setq hiddenp (outline-invisible-p)) (end-of-line 1) (and (equal (char-after) ?\n) (forward-char 1)) -(while (looking-at "^[ \t]*\\(:CLOCK:\\|:LOGBOOK:\\|CLOCK:\\|:END:\\)") - (if (member (match-string 1) '("CLOCK:" ":END:")) +(while (looking-at + org-clock-re) + (if (member (match-string 1) + org-skip-line-list) ;; just skip this line (beginning-of-line 2) ;; Drawer start, find the end @@ -17589,7 +17601,8 @@ With prefix ARG, change that many days." "Is the cursor on the clock log line?" (save-excursion (move-beginning-of-line 1) -(looking-at "^[ \t]*CLOCK:"))) +(looking-at + org-clock-line-re))) (defvar org-clock-history) ; defined in org-clock.el (defvar org-clock-adjust-closest nil) ; defined in org-clock.el -- 2.1.0.rc1 -- Konubinix GPG Key: 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A pgpUQASVtqeH1.pgp Description: PGP signature
Re: [O] contribute: three pane mode for org
On Tuesday, 26 Aug 2014 at 21:36, Florian Knupfer wrote: > your very welcome, > i'll refactor the code a bit and clean up in the next days and think that its > than mostly complete. > If you've got suggestions concerning features or the code, I would be > pleased to hear from, enabling me to learn. A couple of quick points: - the highlight of headline seems to work in the OVERVIEW window but doesn't track lower down in the CONTENTS window. - I use org indent mode and visual-line-mode so lines wrap in the screen. This makes the OVERVIEW and CONTENTS windows messy. It would be nicer to have those windows truncate lines if possible. thanks, eric -- : Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-284-g2593b4
Re: [O] [PATCH] Make use of the constant `org-clock-string' whenever possible
Hello, Samuel Loury writes: > About org-element.el, I would be happy to try. I guess the best > documentation is the file itself (it appears to be quite well > commented). Is it a good way to start? There are also bits of documentation here and there, on the ML, in the "ox.el" reference... I'm in the process of writing a small document collecting these bits. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Make use of the constant `org-clock-string' whenever possible
Samuel Loury writes: > Nonetheless, please find attached a revised version of the patch with > your comments taken into account. Applied (with some spurious newlines removed). Thank you. Regards, -- Nicolas Goaziou
Re: [O] contribute: three pane mode for org
Florian Knupfer writes: > Hello, > > I've written a function that enables a three pane view on org files. > I'm quite new to emacs but I'd like to contribute and receive > feedbacks, improvement etc. > > It can be found at: > https://github.com/knupfer/org-panes > > Best regards very good and integrates nicely with the current workflow. Why not 2 panes only (content and showall) ? Best Ernesto
Re: [O] contribute: three pane mode for org
Ernesto Durante writes: > Florian Knupfer writes: > >> Hello, >> >> I've written a function that enables a three pane view on org files. >> I'm quite new to emacs but I'd like to contribute and receive >> feedbacks, improvement etc. >> >> It can be found at: >> https://github.com/knupfer/org-panes >> >> Best regards > > very good and integrates nicely with the current workflow. > Why not 2 panes only (content and showall) ? Are you aware of navi-mode.el? It does exactly this - put the overview (-> content) in a second window next to the details (-> showall). Only that the overview is a *Navi* buffer that is - plain read-only text (not a folded outline), what has many advantages (though, like in occur and dired, 'M-x navi-edit-mode' makes the buffer temporarily editable and propagates changes to the associated Org/Outshine buffer) - a pretty smart remote-control of the associated Org (or Outshine) buffer, offering many different views on the Org buffer, and lots of navigation & structure editing commands with vim-like one-key-bindings. Keys 1 to 8 in the *Navi* buffer show the headlines up to that level. Additionally, these keyword searches have been defined for Org-mode: , | [KEY] : [SEARCH] | | b : srcblock | x : time | I : inline-srcblock | W : srcname-w-name | M : multilineheader | Y : priority | T : target | R : radiotarget | D : drawer | S : timestamp | N : srcname | U : result | Z : result-w-name | O : options | P : propertydrawer | A : deadline | H : scheduled-time-hour ` (note that these searches are customizable, so they can be modified or extended by the user via the customize interface) With a prefix-arg, you can combine headline and keyword searches. E.g. given this Org buffer , | * A | ** B | | #+BEGIN_SRC emacs-lisp | (+ 2 2) | #+END_SRC | | #+results: | : 4 | | ** C :mytag: |DEADLINE: <2014-08-27 Mi 22:00> | *** [#A] D | very important ` trigger *Navi* buffer with ,[ C-h f navi-search-and-switch RET ] | navi-search-and-switch is an interactive Lisp function in | `navi-mode.el'. | | It is bound to M-s n. | | (navi-search-and-switch) | | Call `occur' and immediatley switch to `*Navi:original-buffer-name*' buffer ` then typing '2' shows , | 1:* A | 2:** B | 11:** C :mytag: ` typing 'A' shows , | 12: DEADLINE: <2014-08-27 Mi 22:00> ` and combining headline with keyword-searches with 'C-2 A' or 'C-u 2 A' shows , | 1:* A | 2:** B | 11:** C :mytag: | 12: DEADLINE: <2014-08-27 Mi 22:00> ` The *Navi* buffer is like a remote-control for the associated Org or Outshine buffer, here is a list of things (besides the headline and keyword searches) you can do without leaving the *Navi* buffer (using vim-like one-key bindings): ,[ C-h f navi-mode RET ] | navi-mode is an interactive Lisp function in `navi-mode.el'. | | (navi-mode) | | Parent mode: `occur-mode'. | | Major mode for easy buffer-navigation. | In this mode (derived from `occur-mode') you can easily navigate | in an associated original-buffer via one-key commands in the | navi-buffer. You can alter the displayed document structure in | the navi-buffer by sending one-key commands that execute | predefined occur searches in the original buffer. `navi-mode' is | especially useful in buffers with outline structure, e.g. buffers | with `outline-minor-mode' activated and `outshine' extensions | loaded. | key binding | --- --- | | C-c Prefix Command | TAB navi-cycle-subtree | RET occur-mode-goto-occurrence | C-o occur-mode-display-occurrence | ESC Prefix Command | SPC scroll-up-command | ! .. *navi-generic-command | + navi-demote-subtree | , navi-act-on-thing-at-point | - navi-promote-subtree | . scroll-other-window | / .. 9navi-generic-command | : scroll-other-window-down | ; navi-generic-command | < navi-move-down-subtree | = .. Dnavi-generic-command | E navi-edit-mode | F .. ]navi-generic-command | ^ navi-move-up-subtree | _ .. bnavi-generic-command | c navi-copy-thing-at-point-to-register-s | d occur-mode-display-occurrence | e navi-edit-as-org | f navi-generic-command | g navi-revert-function | h navi-show-help | i navi-isearch | j navi-generic-command | k navi-kill-
Re: [O] [PATCH] Make use of the constant `org-clock-string' whenever possible
Dnia 2014-08-27, o godz. 09:34:16 Nicolas Goaziou napisał(a): > There are also bits of documentation here and there, on the ML, in the > "ox.el" reference... I'm in the process of writing a small document > collecting these bits. Wow, that would be cool! I tried to look into the docstrings in org-element.el, but found them a bit intimidating. Especially that I know very little about Org's internal data structures. > Regards, Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Re: [O] Worg Tutorial error: using Emacs lisp as formulas
Ciaran Mulloy writes: > Hi Nick, > Many thanks for your input. > > The table I was trying was the example in the tutorial shown as follows > (not big) and no hint of a regex!: > > | Col1 | Col2 | Col3 | Col4 | Col5 | > |--+--+--+--+--| > | a| a| :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 > @2$2..@>$2)) " ") | b| | > | b| a| | | | > | c| d| | | | > > #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 > @2$2..@>$2)) " ") > > I'm not sure where you got this: the tutorial's table does not have a field formula afaict. If you eliminate the field formula, the example works - just do C-c C-c on the #+TBLFM: line: --8<---cut here---start->8--- | Col1 | Col2 | Col3| Col4 | Col5 | |--+--+-+--+--| | a| a| | b| | | b| a| | | | | c| d| | | | #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") --8<---cut here---end--->8--- I don't know why the field formula fails. > > The version of emacs is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, ) of > 2013-07-27 on roseapple, modified by Debian > Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ > /usr/share/emacs/24.3/lisp/org/) > -- Nick
Re: [O] How to represent this in Org-mode
Hi Marcin, Marcin Borkowski writes: > How to represent such a partially ordered set in > Org-mode? One idea that comes to my mind is writing a normal outline > (tree) with all the modules (possibly nested), and including links to > all "prerequisites" in every such module. Any other ideas? I'm quite curious to know how you solved the problem, since I might try to do something similar (but probably not with Org mode). Would you like to share your solution ? Thanks, -- Nico.
[O] Bug: (org-clock-in 64) leads to redundant clock entries [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
Hi, Maybe I missed something obvious, but I find c-u c-u c-u c-c c-x c-i does not work as the docstring says. Steps to reproduce the problem follows. - emacs -q - (find-file "test.org") - insert a header, clock in (say 15:39) - clock out after more than 1 minute (say 15:43) - insert another header - (org-clock-in 64) I expect there be one and only one clock entry (15:43). But what I got was 2 entries. The org file is something like the following. * head one CLOCK: [2014-08-27 Wed 15:39]--[2014-08-27 Wed 15:43] => 0:04 * (org-clock-in 64) leads to redundant clock entry CLOCK: [2014-08-27 Wed 15:44] CLOCK: [2014-08-27 Wed 15:43] The following lines in org-clock.el bother me a little. (when (equal select '(64)) ;; Set start-time to `org-clock-out-time' (let ((org-clock-continuously t)) (org-clock-in nil org-clock-out-time))) Why does it call itself recursively instread of simply setting parameter start-time to org-clock-out-time? Emacs : GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2) of 2014-06-07 on barber, modified by Debian Package: Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/) -- REN Lifeng
Re: [O] Worg Tutorial error: using Emacs lisp as formulas
On 27/08/14 08:21, Ciaran Mulloy wrote: > On 27/08/14 03:52, Nick Dokos wrote: >> Ciaran Mulloy writes: >> >>> Hi! >>> I was fascinated to work through the examples provided in the >>> org-tutorials sections under Worg and really see the power of using >>> eLisp as spreadsheet formula: http://orgmode.org/worg/ >>> org-tutorials/org-spreadsheet-lisp-formulas.html >>> >>> However the use of the mapconcat function always generated an error: >>> Invalid regex "Regular expression too big", even with only a few >>> terms in the formula. >>> >>> The offending formula was: >>> >>> #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 >>> @2$2..@>$2)) " ") >>> >>> I experimented with variations of the formula getting the same error >>> every time. >>> >>> I did a search of the org-mode forum without finding any solution. >>> >>> Any thoughts? >>> >> I can't reproduce it - e.g. this >> >> --8<---cut here---start->8--- >> | one | two | three | four | five | >> |-+-+---+--+--| >> | a | a | a b c e f d g | | | >> | a | b | | | | >> | b | a | | | | >> | c | d | | | | >> | e | f | | | | >> | f | g | | | | >> | a | f | | | | >> #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 >> @2$2..@>$2)) " ") >> --8<---cut here---end--->8--- >> >> works fine for me. This is with more-or-less latest org. >> >> Moreover, none of the functions used (mapconcat, identity, delete-dups >> or list) use regexps at all. There is a chance that regexps are used by >> the evaluator when building the ranges, but it's unlikely IMO, so the >> regexp error seems like a red herring to me. How big a table did you >> try? Did you try restarting emacs and redoing the evaluation? How about >> starting emacs without any of your customizations and redoing the >> evaluation? Something like this >> >>emacs -q -l /path/to/minimal/init /path/to/file/with/the/table >> >> where the minimal init file just sets load-path if necessary and >> initializes org. >> > Hi Nick, > Many thanks for your input. > > The table I was trying was the example in the tutorial shown as follows > (not big) and no hint of a regex!: > > | Col1 | Col2 | Col3 | Col4 | Col5 | > |--+--+--+--+--| > | a| a| :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 > @2$2..@>$2)) " ") | b| | > | b| a| | | | > | c| d| | | | > #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 > @2$2..@>$2)) " ") > > > I did as you suggested and ran emacs -q -l ~/.emacs ~/path_to_file and > got the same result as above: > > org-table-eval-formula: Invalid regexp: "Regular expression too big" > > The .emacs file is blank. > > The version of emacs is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, ) of > 2013-07-27 on roseapple, modified by Debian > Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ > /usr/share/emacs/24.3/lisp/org/) > > Using Mint 17 Xfce. > > I don't think I'm doing something silly here but am at a loss to figure > out the problem. > > > Hi, Further to my earlier posting, tried calculating the table on my PC in work and it worked! So I'm a little puzzled at what the differences are. Configurations as follows: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07 on lamiak, modified by Debian Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/) Cinnamon Mint 64 bit version 17
[O] Emacs speaks to spreadsheet
To make a plot using org-babel/R with org-table (as data.frame) is an ultimate weapon for me. Thank you for development. Occasionally I want to transport datasets between Excel and org-table. Two essential operations are (a) to copy cells from Excel and paste into org-table and (b) other way around. How those would work is describe as below. (a) Copy cells from Excel and paste into org-table - Datasets copied at Excel are stored in kill-ring as tabulated text. Tabulated text would be converted into org-table-clip. - A user selects a cell in org-table and pastes the datasets by (org-table-paste-rectangle) (b) Copy cells from org-table and paste into Excel - A user selects cells by mouse drag on org-table and copies datasets by (org-table-copy-region). - The datasets are store as org-table-clip. They would be converted into tabulated text and stored in kill-ring. - A user will paste the datasets in Excel When those are assigned to (a) M-s-v and (b) M-s-c, Emacs speaks to spreadsheet nicer than I expected. I want to let you know! Followings barely work. -- (global-set-key (kbd "M-s-x") 'orgtbl-cell-cut) (global-set-key (kbd "M-s-c") 'orgtbl-cell-copy) (global-set-key (kbd "M-s-v") 'orgtbl-cell-paste) (defun orgtbl-cell-copy () "Copy cells in org-table and store as tabulated text in kill-ring." (interactive) (if (org-at-table-p) (progn (call-interactively 'org-table-copy-region) (clip-orgtbl2tab) (exchange-point-and-mark)) (call-interactively 'copy-rectangle-as-kill) (clip-rectangle2text))) (defun orgtbl-cell-cut () "Cut cells in org-table and store as tabulated text in kill-ring." (interactive) (if (org-at-table-p) (progn (call-interactively 'org-table-cut-region) (clip-orgtbl2tab)) (call-interactively 'kill-rectangle) (clip-rectangle2text))) (defun orgtbl-cell-paste (&optional arg) "Paste tabulated text stored in kill-ring into org-table. If point is not on org-table, this creates a new org-table." (interactive "P") (cond (arg (org-table-paste-rectangle)) ((org-at-table-p) ; (org-table-check-inside-data-field t) (clip-tab2orgtbl) (org-table-paste-rectangle)) (t (let (tempclip-in-orgtbl) (with-temp-buffer (org-table-create "1x1") (goto-char (+ 1 (point))) (clip-tab2orgtbl) (org-table-paste-rectangle) (mark-whole-buffer) (setq tempclip-in-orgtbl (buffer-substring (point-min) (point-max (insert tempclip-in-orgtbl) (defun clip-tab2orgtbl () "Create org-table-clip from tabulated text stored in kill-ring." (with-temp-buffer (org-mode) (yank) (orochi-tbl-tab2org (point-min) (point-max)) (goto-char (+ 1 (point-min))) (org-table-align) (org-table-copy-region (+ 1 (point-min)) (- (point-max) 2 (defun clip-orgtbl2tab () "Store tabulated text to kill-ring that was converted from org-table-clip." (with-temp-buffer (org-mode) (org-table-create "1x1") (goto-char (+ 1 (point-min))) (org-table-paste-rectangle) (mark-whole-buffer) (call-interactively 'orochi-tbl-org2tab) (mark-whole-buffer) (call-interactively 'kill-region))) (defun clip-rectangle2text () "Convert killed-rectangle to normal text and store in kill-ring." (with-temp-buffer (yank-rectangle) (mark-whole-buffer) (call-interactively 'kill-region))) (defun orochi-tbl-org2tab (start end) "Convert orgtbl on region to tab delimited text" (interactive "r") (orochi-replace-regexps '(("^\s*\|\-.*\n" . "") ("^\s*\|\s*". "") ("\s*\|\s*$". "") ("\s*\|\s*" . " ")) start end)) (defun orochi-replace-regexps (rep-list start end) "Find and replace region for a set of regexps" (save-excursion (save-restriction (narrow-to-region start end) (dolist (re-rep rep-list) (goto-char (point-min)) (while (re-search-forward (car re-rep) nil t) (replace-match (cdr re-rep)))
Re: [O] HTML lists are including paragraphs (…)
It works very well now, thank you. El Tue, 26 Aug 2014 09:59:24 +0200 Nicolas Goaziou va escriure: > > Daniel Clemente writes: > > > Ok, let's keep the complex cases possible, but the simple ones simple. So: > > - text and text if there's only 1 text or sublist or > > text+sublist > > - [normal flow including p,ol,ul,blockquote,…] in the rest. > > This includes , , > > , > > Fair enough. This is now implemented in master. Please report if it > isn't working as expected. > > Thank you. > > > Regards, > > -- > Nicolas Goaziou
Re: [O] [RFC] Rewrite radio tables
Am Sonntag, 24. August 2014, 21:25:57 schrieb Nicolas Goaziou: > Hello, > > The following patch implements radio tables and `orgtbl-to-...' > functions using Org export engine. The implementation is probably not > totally backward compatible, though. Hello, I'm really interested in improvments of orgtbl and exporting to LaTeX, but as a user I have no idea what to do with the patchfile. If I can patch against a file of orgmode 8.2.7, please drop a line. However, @Nicolas, thank you very much for time and effort. Regards, Alexander
[O] words from radio links are not visible when exporting subtrees
Hi, with latest org-mode and this 4-line org: * <<>> * aaa ** export only this subtree (you'll lose a word) ABC Go to the „**“ and use C-c C-e C-s h H (export subtree to HTML). The result has the word „word“ missing from title and header: export only this subtree (you'll lose a ) export only this subtree (you'll lose a ) I tried to bisect it but export stopped working for other reasons.
Re: [O] Worg Tutorial error: using Emacs lisp as formulas
Hello Ciaran, given your example: > | Col1 | Col2 | Col3 | Col4 | Col5 | > |--+--+--+--+--| > | a| a| :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 > @2$2..@>$2)) " ") | b| | > | b| a| | | | > | c| d| | | | > #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 > @2$2..@>$2)) " ") I confirm I see your same hitting C-c C-c in the cell containing the formula. My setup is: - Org 8.2.7c - GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600) of 2013-03-17 on MARVIN - Win 7 Further observations I collected are: 1) if I use "II-1" instead of ">" in the formula (though it's not exactly the same) it works properly. 2) I tried to reduce the test case to a simpler formula: for example :='(length (list @2$1..@>$1)) gave me another, maybe more helpful error message: user-error: Spreadsheet error: invalid reference "'(length (list @2$1..@>$1))" toggle-debug-on-error did not work for case 2) because it's a "catched" error condition. Some random debugging made me think the problem lies in (or around) function `org-table-get-range'. Kindest regards, Andrea
Re: [O] dropping the debian version
Sharon Kimble writes: > I'm sorry Achim, but what do you mean by that? Giving that command on the command line. > 'site-lisp'? Where’s that then please? Its not in the org-mode that > comes with the git output, and I don't have one in my bog-standard emacs > in my /home directory at ~/.emacs.d/ On a stock Debian system you'd usually find it in /usr/share/emacs/site-lisp and the above invocation would install into subdirectory org. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Wavetables for the Terratec KOMPLEXER: http://Synth.Stromeko.net/Downloads.html#KomplexerWaves
Re: [O] make orgtbl-ascii-plot easier to install
Hereafter is an enhanced version of orgtbl-ascii-plot. Thanks, Nicolas, for your feedback. Enhancements you suggested include: - let-binding (instead of setq) - better support for table headers (correct parsing of 'hline) - no dependency on cl-lib (hopefully achieving Emacs 23 support) - use dolist (instead of mapc) - clean up doc-strings Have fun Thierry >From 002e3b5baec9ba513c70914b9bfe17966aa9ca24 Mon Sep 17 00:00:00 2001 From: Thierry Banel Date: Wed, 27 Aug 2014 23:11:11 +0200 Subject: [PATCH] Add ascii plotting in tables * org-table.el (orgtbl-ascii-plot): top-level function. (orgtbl-ascii-draw), (orgtbl-uc-draw-grid), (orgtbl-uc-draw-cont): functions which go in table formulas for drawing bars. * org.el: key binding and menu binding Thanks to Michael Brand and Nicolas Goaziou for feedback and enhancements. --- lisp/org-table.el | 105 +- lisp/org.el | 4 ++- 2 files changed, 107 insertions(+), 2 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 06a1008..88ae094 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -4326,7 +4326,8 @@ to execute outside of tables." ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-"] ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-"] ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-"] - ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-"]) + ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-"] + ["Ascii plot" orgtbl-ascii-plot :active (org-at-table-p) :keys "C-c p"]) ("Row" ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-"] ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-"] @@ -5008,6 +5009,108 @@ it here: http://gnuvola.org/software/j/aa2u/ascii-art-to-unicode.el."; (user-error "Please download ascii-art-to-unicode.el (use C-c C-l to insert the link to it)")) (buffer-string))) +;; Put the cursor in a column containing numerical values +;; of an Org-Mode table, +;; type C-c p +;; A new column is added with a bar plot. +;; When the table is refreshed (C-u C-c *), +;; the plot is updated to reflect the new values. + +(defun orgtbl-ascii-draw (value min max &optional width characters) + "Draws an ascii bar in a table. +VALUE is a the value to plot, the width of the bar to draw. A +value equal to MIN will be displayed as empty (zero width bar). +A value equal to MAX will draw a bar filling all the WIDTH. +WIDTH is the expected width in characters of the column. +CHARACTERS is a string that will compose the bar, with shades of +grey from pure white to pure black. It defaults to a 10 +characters string of regular ascii characters." + (let* ((characters (or characters " .:;c!lhVHW")) + (width (or width 12)) + (value (if (numberp value) value (string-to-number value))) + (value (* (/ (- (+ value 0.0) min) (- max min)) width))) +(cond + ((< value 0) "too small") + ((> value width) "too large") + (t + (let ((len (1- (length characters + (concat + (make-string (floor value) (elt characters len)) + (string (elt characters + (floor (* (- value (floor value)) len)) + +;;;###autoload +(defun orgtbl-ascii-plot (&optional ask) + "Draws an ascii bars plot in a column. +With cursor in a column containing numerical values, this +function will draw a plot in a new column. ASK, if given, is a +numeric prefix to override the default 12 characters width of the +plot. ASK may also be the C-u prefix, which will prompt for the +width." + (interactive "P") + (let ((col (org-table-current-column)) + (min 1e999) ;; 1e999 will be converted to infinity + (max -1e999) ;; which is the desired result + (table (org-table-to-lisp)) + (length + (cond ((consp ask) + (read-number "Length of column " 12)) + ((numberp ask) ask) + (t 12 +(dolist (x + (let ((t1 ;; skip table header + (if (eq (car table) 'hline) + (cdr table) + table))) + (or (cdr (memq 'hline t1)) t1))) + (when (consp x) + (setq x (nth (1- col) x)) + (when (string-match + "^[-+]?\\([0-9]*[.]\\)?[0-9]*\\([eE][+-]?[0-9]+\\)?$" + x) + (setq x (string-to-number x)) + (when (> min x) (setq min x)) + (when (< max x) (setq max x) +(org-table-insert-column) +(org-table-move-column-right) +(org-table-store-formulas + (cons + (cons + (number-to-string (1+ col)) + (format "'(%s $%s %s %s %s)" + "orgtbl-ascii-draw" col min max length)) + (org-table-get-stored-formulas))) +(org-table-recalculate t))) + +;; Example of extension: unicode characters +;; Here are two examples of different styles. + +;; Unicode block characters are used to give a smooth effect. +;; See http://en.wikipedia.org/wiki/Block_Elements +;; Use one of those drawing functions +;; - orgtbl-ascii-draw (the default ascii) +;; - orgtbl-uc-draw-grid (u
Re: [O] words from radio links are not visible when exporting subtrees
Hello, Daniel Clemente writes: > Hi, with latest org-mode and this 4-line org: > > > * <<>> > * aaa > ** export only this subtree (you'll lose a word) > ABC > > > > Go to the „**“ and use C-c C-e C-s h H (export subtree to HTML). The result > has the word „word“ missing from title and header: > > export only this subtree (you'll lose a ) > export only this subtree (you'll lose a ) > > > I tried to bisect it but export stopped working for other reasons. I think this bug came with the initial merge of the new export framework. Anyway, it should be fixed. Thank you for reporting it. Regards, -- Nicolas Goaziou
Re: [O] make orgtbl-ascii-plot easier to install
Thierry Banel writes: > Hereafter is an enhanced version of orgtbl-ascii-plot. > > Thanks, Nicolas, for your feedback. Enhancements you suggested include: > - let-binding (instead of setq) > - better support for table headers (correct parsing of 'hline) > - no dependency on cl-lib (hopefully achieving Emacs 23 support) > - use dolist (instead of mapc) > - clean up doc-strings Thank you. > +(defun orgtbl-ascii-plot (&optional ask) > + "Draws an ascii bars plot in a column. > +With cursor in a column containing numerical values, this > +function will draw a plot in a new column. ASK, if given, is a You forgot a space at the end of the sentence. Actually, this is the case in all your docstrings. > +numeric prefix to override the default 12 characters width of the > +plot. ASK may also be the C-u prefix, which will prompt for the > +width." Use "\\[universal-argument]" instead of "C-u". > +(dolist (x > + (let ((t1 ;; skip table header > + (if (eq (car table) 'hline) > + (cdr table) > + table))) Just to be sure to catch the following (odd) table || || | header | || | values | I suggest the following (while (eq (car table) 'hline) (setq table (cdr table))) (dolist (x (or (cdr (memq 'hline table)) table)) (when (consp x) (setq x (nth (1- col) x)) (when (string-match "^[-+]?\\([0-9]*[.]\\)?[0-9]*\\([eE][+-]?[0-9]+\\)?$" x) (setq x (string-to-number x)) (when (> min x) (setq min x)) (when (< max x) (setq max x) > +(defun orgtbl-uc-draw-grid (value min max &optional width) > + "Draws an ascii bar in a table. It is a variant of The second sentence should start a new line. > +(defun orgtbl-uc-draw-cont (value min max &optional width) > + "Draws an ascii bar in a table. It is a variant of Ditto. Regards, -- Nicolas Goaziou
Re: [O] Worg Tutorial error: using Emacs lisp as formulas
On 27/08/14 12:52, Nick Dokos wrote: Ciaran Mulloy writes: Hi Nick, Many thanks for your input. The table I was trying was the example in the tutorial shown as follows (not big) and no hint of a regex!: | Col1 | Col2 | Col3 | Col4 | Col5 | |--+--+--+--+--| | a| a| :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") | b| | | b| a| | | | | c| d| | | | #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") I'm not sure where you got this: the tutorial's table does not have a field formula afaict. If you eliminate the field formula, the example works - just do C-c C-c on the #+TBLFM: line: --8<---cut here---start->8--- | Col1 | Col2 | Col3| Col4 | Col5 | |--+--+-+--+--| | a| a| | b| | | b| a| | | | | c| d| | | | #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") --8<---cut here---end--->8--- I don't know why the field formula fails. The version of emacs is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, ) of 2013-07-27 on roseapple, modified by Debian Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/) Hi Guys, Some definite strangeness that I'd love to get to the bottom of, if only to preserve my sanity and understanding of how Org-Mode works! The following is the example given in the excellent Worg tutorial on using Emacs Lisp in spreadsheet formulas: http://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-formulas.html | Col1 | Col2 | Col3 | Col4 | Col5 | |--+--+--+--+--| | a| a| | d| | | a| b| | | | | b| a| | | | | c| d| | | | Inserting the following as a field formula in location @2$3: :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") and doing a C-c or a C-u-C-c C-c generates an 'Invalid regexp: "Regular expression too big"' error. I used the formula debug option C-{ to enable formula debugging and got the following result: With the debugging formula on, when the debugger asks whether to continue on the newly entered formula I get the following output and the error is resolved and formula properly calculated as shown below. This is the output provided by the formula debugger: Substitution history of formula Orig: '(mapconcat 'identity (delete-dups (list @2$1..@5$1 @2$2..@5$2)) " ") $xyz-> '(mapconcat 'identity (delete-dups (list @2$1..@5$1 @2$2..@5$2)) " ") @r$c-> '(mapconcat 'identity (delete-dups (list #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("c" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("d" 0 1 (fontified t org-category "spreadsheets" face org-table " ") $1->'(mapconcat 'identity (delete-dups (list #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("c" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("d" 0 1 (fontified t org-category "spreadsheets" face org-table " ") Result: a b c d Format: NONE Final: a b c d After The formula was correctly resolved and shows the following result correctly: | Col1 | Col2 | Col3| Col4 | Col5 | |--+--+-+--+--| | a| a| a b c d | d| | | a| b| | | | | b| a| | | | | c| d| | | | #+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") The output in the messages file is as follows: Loading 00debian-vars...done Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)... Loading debian-ispell... Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done Loading debian-ispell...done Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Loading vc-git...done Formula debugging has been turned on R
Re: [O] [RFC] Rewrite radio tables
Hello, AW writes: > I'm really interested in improvments of orgtbl and exporting to LaTeX, but as > a user I have no idea what to do with the patchfile. > > If I can patch against a file of orgmode 8.2.7, please drop a line. This patch is against master. Though, you can try applying it on maint. Save the patch in your local org-mode repository. Possibly create a new branch on top of maint. Then from dired, with point on the file: ! git am RET The patch should be installed as the head of your current branch (unless there are conflicts). Regards, -- Nicolas Goaziou
[O] [bug] exporting to org corrupts outline
don't know if i am doing something wrong, but i tried a few variants both programmatically and interactively. * exporting i exported 1 as a subtree to org: *** 1 * 2 *** 3:export: * 4 *** 5 *** output in org maint in emacs 24.4 i got: corrupted levels 4 is promoted i expected 4 to still be under 3 wrong format for outline does not respect org-odd-levels-only needed for re-use in the same environment that produced it no top level i expected 1 istr 1 exports in ascii and html same output with export tag on 2; same with noexport on 1 : * 2 : ** 3 : ** 4 : *** 5 -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. And ANYBODY can get it. Denmark: free Karina Hansen NOW.
Re: [O] Worg Tutorial error: using Emacs lisp as formulas
Ciaran Mulloy writes: > Inserting the following as a field formula in location @2$3: > :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") > and doing a C-c or a C-u-C-c C-c generates an 'Invalid regexp: "Regular > expression too big"' error. > > It seems that I can reliably reproduce a bug that I haven't been able to > find on forums and that most other people have difficulty replicating. > If I've done something to my installation of emacs I'd love to find out > what has caused the problem. > > Is there a way of determining what could be my issue? Hello Ciaran, long story short: digging in org-table.el I noticed that functions f1=`org-table-formula-handle-first/last-rc' and f2=`org-table-formula-substitute-names' were used sometimes like this: (f2 (f1 x)), and sometimes like this: (f2 x). I conjecture it should always be (f2 (f1 x)), so I applied to my org-table.el, reloaded its definitions with `eval-buffer' and... it worked! File formula.diff attached here shows the exact changes that I applied on my org-table.el. (if you try formula.diff and it works for you, beware that you need to remove or recompile the old org-table.elc file). diff -c "-L" "c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140804/org-table.el" "-L" "#" "c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140804/org-table.el" "c:/Users/andrea/AppData/Local/Temp/buffer-content-3236IUh" *** c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140804/org-table.el --- # *** *** 2600,2606 (unless (string-match "\\S-" fmt) (setq fmt nil (if (and (not suppress-const) org-table-formula-use-constants) ! (setq formula (org-table-formula-substitute-names formula))) (setq orig (or (get-text-property 1 :orig-formula formula) "?")) (while (> ndown 0) (setq fields (org-split-string --- 2600,2606 (unless (string-match "\\S-" fmt) (setq fmt nil (if (and (not suppress-const) org-table-formula-use-constants) ! (setq formula (org-table-formula-substitute-names (org-table-formula-handle-first/last-rc formula (setq orig (or (get-text-property 1 :orig-formula formula) "?")) (while (> ndown 0) (setq fields (org-split-string *** *** 3767,3773 (if (eq what 'name) (setq var (substring match 1))) (when (eq what 'range) (or (equal (string-to-char match) ?@) (setq match (concat "@" match))) ! (setq match (org-table-formula-substitute-names match))) (unless local (save-excursion (end-of-line 1) --- 3767,3773 (if (eq what 'name) (setq var (substring match 1))) (when (eq what 'range) (or (equal (string-to-char match) ?@) (setq match (concat "@" match))) ! (setq match (org-table-formula-substitute-names (org-table-formula-handle-first/last-rc match (unless local (save-excursion (end-of-line 1) Diff finished. Thu Aug 28 01:17:44 2014 Hope it may be of some help, kindest regards. Andrea
[O] [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion
Good evening, The `R' programming language lets you set a custom prompt by evaluating this `R' code: ╭ │ options(prompt="ℝ> ") ╰ When you are using `ess' [1] you need to let it know that you are using a different prompt than the defult by customizing the following value like this: ╭ │ (defcustom inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)*ℝ+> " │ "Regexp used in S and R inferior and transcript buffers for prompt navigation. │ Customise it to make `comint-previous-prompt' quiqly navigate to │ interesting portions of the buffer. │ " │ :group 'ess-proc │ :type 'string) ╰ In order for `babel' to work correctly with the custom prompt currently I make a change manually to ob-R.el in the function `org-babel-R-evaluate-session' to modify the regex to look like this: ╭ │ "^\\([ ]*[ℝ>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" ╰ Instead of making the change by hand I would like to add a new customizable value to ob-R that contains the regex. The goal is to let the user customize it themselves to accomodate any prompt. A couple of weeks ago I posted a [patch] with that intent, and aaronecay provided valuable feedback… but what I did wrong was both not discussing it with anyone before I sent that patch and I also was too aggressive with the change (it was a bad idea for the change). Question: • What do you think of such a change? • Do you have a desired approach? • Would you like a patch? • My change would be really basic, just add a new defcustom to store the regex and reference it in the session evalution function It would change from this ╭ │ (if (string-match │ "^\\([ ]*[ℝ>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line) │ (substring line (match-end 1)) │ line) ╰ to this ╭ │ (if (string-match │ inferior-R-prompt line) │ (substring line (match-end 1)) │ line) ╰ ╭ │ emacs-version ╰ ╭ │ 24.3.1 ╰ ╭ │ org-version ╰ ╭ │ 8.2.7c ╰ ╭ │ ess-version ╰ ╭ │ 14.06 ╰ Kind regards, [patch] https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00753.html Footnotes ─ [1] [http://ess.r-project.org/] Grant Rettke | ACM, ASA, FSF g...@wisdomandwonder.com | http://www.wisdomandwonder.com/ “Wisdom begins in wonder.” --Socrates ((λ (x) (x x)) (λ (x) (x x))) “Life has become immeasurably better since I have been forced to stop taking it seriously.” --Thompson
Re: [O] [RFC] [PATCH] ox-latex: support :float no with caption for minted listings
Hi Nicolas, 2014ko abuztuak 24an, Nicolas Goaziou-ek idatzi zuen: > > Hello, > > Aaron Ecay writes: > >> Why is the compatibility=false option needed? I can’t figure this >> out. > > This is in my local copy of the minted manual, in "7 Known issues". It > may be outdated, though. Hmm. I had not seen that in the manual; good catch. There didn’t seem to be any problems in the test documents I worked with, but they were very minimalistic so perhaps don’t exercise the problem areas. Anyway, the suggestion from Nicolas R. of using the capt-of package makes this moot. > >> “Pretty” source code export in all cases requires adding certain packages >> to the default, as explained in the docstring of ‘org-latex-listings’. >> The patch adds discussion of the caption requirement there, so there is >> no “if” about the documentation. >> >> I don’t understand what you’re saying about introducing “support” for >> the caption package. The patch uses one specific feature of the caption >> package in one specific place to accomplish one specific goal. There >> are no other changes needed anywhere else in the codebase than these >> couple of lines in one function (plus the documentation). > > With your patch latex back-end can produce "\captionof" macros. This is > what I call (partial) "support" from Org: knowing the macro. > > Again, using this macro is an error in the default configuration. > Besides not doing using it at all, there are usually two ways to solve > the problem: > > 1. Add the package in the default package list, so the combination > still works out of the box for anyone. E.g., `rotating' package. > Use with care, more packages is a higher risk of incompatibilites > between them. The lighter counterpart of `caption' package may be > safe though. > > OTOH, once the package is in the default package list, it can be > used everywhere in the back-end. This can be an advantage if there > are several places that could use \captionof. The other application I can think of is to allow captioned images and tables not to float. The LaTeX world is full of tutorials on how to un-float floating images and tables, but IME the org community doesn’t ask for this. (perhaps they implement their own solutions in latex.) Given that the capt-of package is just two lines of code, defines just one new command, and doesn’t modify any existing code, I’m inclined to the belief that adding it to the default packages list is tolerable. If capt-of is added to the default packages, then source blocks can also be handled. My original patch did not handle this case, on the theory that default option values should always generate output that complies, even if it’s not correct in other ways. > > 2. Suggest, through docstring or manual, to the user to require > a specific package if he wants to benefit from the feature. E.g., > `booktabs'. > > Usually, the situation makes it obvious that such a package is > required (e.g. ":environment longtabu" or ":booktabs t"). > Unfortunately, this is not the case here. Under some > circumstances, :float nil needs `caption' (or its lighter > counterpart). I find it a bit too magical. I see your point. But, the \captionof command will only be emitted if the user has changed org-latex-listings to a non-default value (i.e. 'minted), necessitating the addition of the minted package to org-latex-packages-alist. The patch adds a note about the caption (-> capt-of) package to the same docstring, so hopefully it will be obvious enough. So this is hopefully a workable backup option to an addition to the default list. > > Note there is also :caption attribute which is used in tables and > special blocks, but not in source blocks, which may come handy > here. I can’t tell what this is for. It looks like merely a backend-specific alternative to specifying the caption using org syntax (#+caption:). Am I missing something? (Actually there seems to be subtle inconsistencies with respect to the handling of attr_latex :caption in the present code, which I will work on a patch to fix...) Thanks, -- Aaron Ecay
Re: [O] [babel-R][RFC] Customizing the R prompt for babel sessions approach, advice, discussion
Hi Grant, 2014ko abuztuak 27an, Grant Rettke-ek idatzi zuen: [...] > > Question: > • What do you think of such a change? > • Do you have a desired approach? > • Would you like a patch? > • My change would be really basic, just add a new defcustom to store > the regex and reference it in the session evalution function I think this patch will be made superfluous by the approach that Charles Berry and I are working on in the thread I linked in my response to your previous email (with useful contributions also from others). Babel will no longer need to know about the user’s prompt customizations (or lack thereof) at all. It’s taking a little bit for me to digest the discussion in that thread, but I hope that if you can live with your local modifications a bit longer you will be pleased with the end result. -- Aaron Ecay
Re: [O] R code block produces only partial output
Hi Chuck, Thanks for your feedback. The patch you’ve sent looks basically correct to me. 2014ko abuztuak 23an, "Charles C. Berry"-ek idatzi zuen: [...] > The old hacky way works pretty well most of the time. I suspect that it > will be hard to get folks to really test a new ob-R.el in advance of its > moving to maint. ./lisp/test-ob-R.el only has one :session src block and > a few other src blocks... Agreed, more tests are something I want to add to this patch before landing it, and I’ll try to encourage that in the future (from myself most of all!). > > I was thinking of having a drop in replacement for the each of the two > functions that are changed and maybe selecting which version to use with > defalias. If there is a slicker way to enable a user to revert to an > earlier version without having good git skills, fine. But I think the > possibility of breaking something that someone needs and not noticing till > the changes go to maint is high. I think that having two different implementations will in the long run increase the surface area susceptible to bugs. We should do our best and then release what we have when we feel it’s stable. (I admit to being a bit bewildered by org’s release process; I just use whatever is in git and deal with the occasional breakage. The big no-no is letting a bug slip into an emacs-bundled version of Org, since that will live for years. But it seems like it takes a long time even after reaching maint for code to make its way into emacs.) [...] > > Not sure I get why the sentinel file is needed, The execution of the R commands is asynchronous (from emacs’ POV); org polls for the existence of this file to let it know that R has finished its execution. > but the patch here uses on.exit(file.create(...)) to ensure that that > file is created. One hiccup (not sure if it exists in master,too) is > that starting a remote session and then trying to run src blocks from > a buffer for a local file will hang (because a local temp file is used > for sentinel). So there is still stuff to do. Hmm, OK. [...] > > Putting objects in userspace is considered poor practice. FWIW, CRAN > disallows it. `environment-hacking' as you call it underlies much of R. If > you must create and hold variables use the attach(NULL,name="org-vars") > trick. I’ll defer to your judgment. Thanks again for the feedback and revised patch. I’ll try to get a few tests written this weekend, and study the remote vs. local files business. -- Aaron Ecay