Re: [O] org-babel-detangle issue on 9.1.14
On Thu, Oct 4, 2018 at 10:53 AM Brad Knotwell wrote: > Thanks for the response. At a minimum, I'd recommend changing the error > message from "Not in a source block" to something more descriptive > as most people's initial response will be, "uhhh, but it looks like I am." Consider submitting your suggestion as a patch so it is super easy to know what change you are suggesting. If you never submitted one before I am glad to help. > Ideally, an additional comment marker would delineate the source block from > the meta-programmed variables to allow the edited source code's > verbatim replacement. Or it might make sense to have a setting that > separates the tangled source file from the meta programmed variables. > Using your example above, it could tangle to something like the following: > > #!/bin/sh > # > [[file:~/tmp/test.org::org_gcr_2018-10-04T08-35-43-05-00_cosmicality_CCEACAA2-A6B3-4FDD-9259-7F633316F0CE][org_gcr_2018-10-04T08-35-43-05-00_cosmicality_CCEACAA2-A6B3-4FDD-9259-7F633316F0CE]] > . ./noideahowtonamethesegenerically.sh# the naming seems tricky to me > echo $x > # > org_gcr_2018-10-04T08-35-43-05-00_cosmicality_CCEACAA2-A6B3-4FDD-9259-7F633316F0CE > ends here One way is that you can keep the values in an external file and load it before each source block in the preamble code? I'm thinking pretty simply but depending on what you wan to do here there might be an easy solution.
Re: [O] Calculate differences of remote table numbers
Hi Karl On Mon, Oct 1, 2018 at 5:02 PM Karl Voit wrote: > I'd like to calculate the differences between rows of numbers of a > different table. For this kind of shifting row or column indexes I use Calc vector subscript. In your case: #+NAME: my-table | Numbers | |-| | 1 | | 5 | | 8 | | 12 | | 15 | | Line | Difference | |--+| |1 || |2 | 4 | |3 | 3 | |4 | 4 | |5 | 3 | #+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table, @I$1..@II$1), @# - 1) - subscr(remote(my-table, @I$1..@II$1), @# - 2)) or, avoiding @# completely in the formula for $2: #+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table, @I$1..@II$1), $1) - subscr(remote(my-table, @I$1..@II$1), $1 - 1)) See also a similar example of subscr in the subsection "Dynamic variation of ranges" here: https://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas Michael
Re: [O] [RFC] Replace lambda functions added to org-mode-hook with named funcs
Hello, Kaushal Modi writes: > Going down the rabbit hole, I discovered many places in Org source > where lambdas were added to org-mode-hook. > > I propose to replace such lamba functions with named functions. > Here's an example of diff on maint branch, after making one such change: > > = > diff --git a/lisp/org.el b/lisp/org.el > index 2cc9b6a1c..9f28502d4 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -7429,10 +7429,10 @@ a block. Return a non-nil value when toggling > is successful." >(when (eq (overlay-get ov 'invisible) 'org-hide-block) > (delete-overlay ov > > -;; Remove overlays when changing major mode > -(add-hook 'org-mode-hook > - (lambda () (add-hook 'change-major-mode-hook > - 'org-show-block-all 'append 'local))) > +(defun org--unfold-all-blocks-on-major-mode-change () > + "Remove overlays when changing major mode." > + (add-hook 'change-major-mode-hook #'org-show-block-all 'append 'local)) > +(add-hook 'org-mode-hook #'org--unfold-all-blocks-on-major-mode-change) If that's a function added to `org-mode-hook', it is not useful to add "on major mode change". > If there is no objection to this, I can fix this everywhere in maint, > and then merge that into master. Please make changes in "master" instead, and merge them into "next" then. Regards, -- Nicolas Goaziou
[O] Skipping the SUBTREE visibility state
Hi Org mode list, I find it really distracting when a large SUBTREE is expanded while browsing through an Org document. Does anyone else find this problematic or am I doing something wrong? Today I explored some ways to avoid this problem and came up with a patch to the ~org-cycle~ function to allow skipping the SUBTREE state. I have included the patch to ~org.el~ inline below. This patch makes a minimal modification to ~org-cycle~, defines a new command ~org-cycle-skip-subtree~ and binds it to C-Tab (overwriting the original binding). I'd like to hear your feedback. Thanks. Btw, I'm new to this sending patches via mailing list so please let me know if I've done something wrong. diff -u "c:/Users/Matthew Palermo/AppData/Roaming/.emacs.d/org.el" "c:/Users/Matthew Palermo/AppData/Roaming/.emacs.d/org-skip.el" --- "c:/Users/Matthew Palermo/AppData/Roaming/.emacs.d/org.el" 2018-04-24 00:17:49.0 +1000 +++ "c:/Users/Matthew Palermo/AppData/Roaming/.emacs.d/org-skip.el" 2018-10-05 17:10:33.347064600 +1000 @@ -6677,7 +6677,7 @@ (apply 'message args))) ;;;###autoload -(defun org-cycle (&optional arg) +(defun org-cycle (&optional arg skipsubtree) "TAB-action and visibility cycling for Org mode. This is the command invoked in Org mode by the `TAB' key. Its main @@ -6817,7 +6817,7 @@ (save-excursion (move-beginning-of-line 1) (looking-at org-outline-regexp))) (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol -(org-cycle-internal-local)) +(org-cycle-internal-local skipsubtree)) ;; From there: TAB emulation and template completion. (buffer-read-only (org-back-to-heading)) @@ -6849,6 +6849,11 @@ (org-back-to-heading) (org-cycle))) +(defun org-cycle-skip-subtree () + "Calls `org-cycle' except it skips the SUBTREE state" + (interactive) + (org-cycle nil t)) + (defun org-cycle-internal-global () "Do the global cycling action." ;; Hack to avoid display of messages for .org attachments in Gnus @@ -6890,7 +6895,7 @@ If POS is nil, use `point' instead." (get-char-property (or pos (point)) 'invisible)) -(defun org-cycle-internal-local () +(defun org-cycle-internal-local (&optional skipsubtree) "Do the local cycling action." (let ((goal-column 0) eoh eol eos has-children children-skipped struct) ;; First, determine end of headline (EOH), end of subtree or item @@ -6936,7 +6941,7 @@ (when (org-invisible-p) (org-flag-heading nil ((and (or (>= eol eos) (not (string-match "\\S-" (buffer-substring eol eos - (or has-children + (or has-children skipsubtree (not (setq children-skipped org-cycle-skip-children-state-if-no-children ;; Entire subtree is hidden in one line: children view @@ -6972,9 +6977,10 @@ (setq org-cycle-subtree-status 'children) (unless (org-before-first-heading-p) (run-hook-with-args 'org-cycle-hook 'children))) - ((or children-skipped - (and (eq last-command this-command) - (eq org-cycle-subtree-status 'children))) + ((and (not skipsubtree) + (or children-skipped + (and (eq last-command this-command) +(eq org-cycle-subtree-status 'children ;; We just showed the children, or no children are there, ;; now show everything. (unless (org-before-first-heading-p) @@ -19508,6 +19514,7 @@ (org-defkey org-mode-map "\C-i" 'org-cycle) (org-defkey org-mode-map [(tab)] 'org-cycle) (org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived) +(org-defkey org-mode-map [(control tab)] 'org-cycle-skip-subtree) (org-defkey org-mode-map "\M-\t" #'pcomplete) ;; The following line is necessary under Suse GNU/Linux Diff finished. Fri Oct 5 18:08:00 2018