Re: [patch] improved: add TTL as defcustom to ox-icalendar
Thank you for the hints. Attached a diff -u version. The patch in principle is unrelated to nextcloud. That's just my use case. The addiditional TTL setting gives a hint to clients when to reload an imported ics file that was exported from org. Is there any document how to setup an org-mode developer environment? Normally I use git, but I even struggled to use org from elpa instead of the built-in version, so I avoided touching this house of cards :-) Probably I should use a git clone instead of elpa, if I want to work on org? Thx for the feedback! Detlef Am Mon, 3 Jan 2022 13:08:54 +0700 schrieb Max Nikulin : > On 02/01/2022 20:28, Detlef Steuer wrote: > > > >> This is my first try ever to contribute anything in elisp. > > Thanks for the patch. It is tracked on https://updates.orgmode.org/ > > It is easier to review and to apply a patch when it it is prepared in > context format ("-u" option of diff). Several additional lines of > code above and below changed ones makes the patch more tolerate to > unrelated changes in the same file. It is a hint for humans as well. > > See info "(diffutils) Tips for Patch Producers" > https://www.gnu.org/software/diffutils/manual/html_node/Tips-for-Patch-Producers.html > > or "NOTES FOR PATCH SENDERS" section in "man patch". > > If you have never used git (or other VCS) before then it is likely an > overkill for a single patch, diff output with manually added > description is OK. However you may find such tool rather convenient > as number of changes will grow. See > https://orgmode.org/worg/org-contribute.html for some hints addressed > to contributors. > > I am not a nextcloud or org-icalendar user, so while I expect that > suggested change is an improvement, I can say nothing concerning the > code. > > --- ox-icalendar.el.orig 2022-01-02 13:38:17.586027624 +0100 +++ ox-icalendar.el 2022-01-02 14:12:10.446157056 +0100 @@ -265,6 +265,19 @@ (const :tag "Universal time" ":%Y%m%dT%H%M%SZ") (string :tag "Explicit format"))) +(defcustom org-icalendar-ttl "PT1H" + "The time to life for the exported calendar. +Subscribing clients to the exported ics file can derive the time interval +to read the file again from the server. One example of such a client is +the nextcloud calendar, which respects the setting of +X-PUBLISHED-TTL, i.e. X-PUBLISHED-TTL:PT1H . + +See https://icalendar.org/iCalendar-RFC-5545/3-8-2-5-duration.html +for a complete description of possiblee values of this option. I.e. +PT1H stands for 1 hour, PT0H27M34S for 0 hours, 27 minutes and 34 seconds." + :group 'org-export-icalendar + :type 'string) + (defvar org-icalendar-after-save-hook nil "Hook run after an iCalendar file has been saved. This hook is run with the name of the file as argument. A good @@ -300,7 +313,8 @@ (:icalendar-store-UID nil nil org-icalendar-store-UID) (:icalendar-timezone nil nil org-icalendar-timezone) (:icalendar-use-deadline nil nil org-icalendar-use-deadline) -(:icalendar-use-scheduled nil nil org-icalendar-use-scheduled)) +(:icalendar-use-scheduled nil nil org-icalendar-use-scheduled) +(:icalendar-ttl nil nil org-icalendar-ttl)) :filters-alist '((:filter-headline . org-icalendar-clear-blank-lines)) :menu-entry @@ -828,24 +842,29 @@ (cadr (current-time-zone))) ;; Description. (org-export-data (plist-get info :title) info) + ;; TTL + org-icalendar-ttl contents)) -(defun org-icalendar--vcalendar (name owner tz description contents) +(defun org-icalendar--vcalendar (name owner tz description ttl contents) "Create a VCALENDAR component. -NAME, OWNER, TZ, DESCRIPTION and CONTENTS are all strings giving, +NAME, OWNER, TZ, DESCRIPTION, TTL and CONTENTS are all strings giving, respectively, the name of the calendar, its owner, the timezone -used, a short description and the other components included." +used, a short description, the time-to-live resp. refresh period and +the other components included." (concat (format "BEGIN:VCALENDAR VERSION:2.0 X-WR-CALNAME:%s PRODID:-//%s//Emacs with Org mode//EN X-WR-TIMEZONE:%s X-WR-CALDESC:%s +X-PUBLISHED-TTL:%s CALSCALE:GREGORIAN\n" (org-icalendar-cleanup-string name) (org-icalendar-cleanup-string owner) (org-icalendar-cleanup-string tz) - (org-icalendar-cleanup-string description)) + (org-icalendar-cleanup-string description) + (org-icalendar-cleanup-string ttl)) contents "END:VCALENDAR\n")) @@ -974,6 +993,7 @@ user-full-name (or (org-string-nw-p org-icalendar-timezone) (cadr (current-time-zone))) org-icalendar-combined-description + org-icalendar-ttl contents))) (run-hook-with-args 'org-icalendar-after-save-hook file))) @@ -998,6 +1018,8 @@ (cadr (current-time-zone))) ;; Description. org-icalendar-combined-description + ;; TTL (Refresh period) + org-icalendar-ttl ;; Contents. (concat ;; Agenda contents.
Re: [patch] improved: add TTL as defcustom to ox-icalendar
On 02/01/2022 20:28, Detlef Steuer wrote: This is my first try ever to contribute anything in elisp. Thanks for the patch. It is tracked on https://updates.orgmode.org/ It is easier to review and to apply a patch when it it is prepared in context format ("-u" option of diff). Several additional lines of code above and below changed ones makes the patch more tolerate to unrelated changes in the same file. It is a hint for humans as well. See info "(diffutils) Tips for Patch Producers" https://www.gnu.org/software/diffutils/manual/html_node/Tips-for-Patch-Producers.html or "NOTES FOR PATCH SENDERS" section in "man patch". If you have never used git (or other VCS) before then it is likely an overkill for a single patch, diff output with manually added description is OK. However you may find such tool rather convenient as number of changes will grow. See https://orgmode.org/worg/org-contribute.html for some hints addressed to contributors. I am not a nextcloud or org-icalendar user, so while I expect that suggested change is an improvement, I can say nothing concerning the code.
Re: [PATCH] make test: Make failure results more verbose
On 02/01/2022 20:12, Ihor Radchenko wrote: In newer Emacs, ERT is capable of providing more info about FAILED tests. Maybe we can enable this option by default in the Org test suite? I like you attempts to make tests better. Ihor, are there examples of new error reports in mail lists, blogs, etc? I am not motivated enough to try development version of emacs, but my impression that current error log looks like rectangles of garbage. In my opinion, code of test should be written having clear error reports in mind. +BTEST_ERT_VERBOSE = yes I am unsure if this line or local.mk has priority. I am unsure the the following is better as well. BTEST_ERT_VERBOSE ?= yes Is there an easy way to limit number of failures before termination of tests in the case of verbose reporting? It should prevent test log from blowing too much. Usually there is no point in all details if all or even 1/4 of tests fails. + TMPDIR=$(testdir) EMACS_TEST_VERBOSE=yes $(BTEST) A purist would say that it is not a directory, it is something like ...FLAGS or ...ARGS. I know, it was abused before your patch. Shouldn't it be mentioned in testing/README?
Re: [PATCH] Re: Escaping org mode date properties
Eduardo Suarez-Santana writes: > However, how about next cases? > > * an example block > #+begin_example > SCHEDULED: <2015-02-16 Mon .+2d> > #+end_example I am unable to reproduce this using Org 9.5.2 Can you provide concrete steps starting from bare Emacs how to reproduce the inconsistency you are seeing? > * an example with colon > : SCHEDULED: <2015-02-16 Mon .+2d> > I think they behave the same way as 'begin_src'. If you mean that adding example/fixed-width environment does not make disappear, I am unable to reproduce. However, the second case is wrongly recognised as a heading with timestamp. Can you try the attached patch? (on top of previous) >> For future. You will make things much easier if you provide a clear >> sequence of steps to reproduce the problem. Your original report is not >> reproducible if I just copy-paste your code into a new org file. I had >> to guess what you did in order to see the problem. > > Sorry about that. I got weird results and was not sure about the expected > behaviour. I had already asked in IRC with no answer. "Weird" usually means that you expect some behaviour, but get surprised. However, for a person far away using different environment and settings (me), it is hard to guess about what went wrong without knowing details of what you did, what you expected, and what went wrong. See https://orgmode.org/worg/org-contribute.html and https://www.chiark.greenend.org.uk/~sgtatham/bugs.html for detailed instructions. Best, Ihor >From 0d91c1bd81cb6fe19666761e50fb1368add385a8 Mon Sep 17 00:00:00 2001 Message-Id: <0d91c1bd81cb6fe19666761e50fb1368add385a8.1641180460.git.yanta...@gmail.com> From: Ihor Radchenko Date: Mon, 3 Jan 2022 11:26:18 +0800 Subject: [PATCH] org-agenda-get-timestamps: Ignore non-timestamps matching re * lisp/org-agenda.el (org-agenda-get-timestamps): Explicitly confirm that object at point is a timestamp. Fixes https://list.orgmode.org/20220102210433.gc29...@itccanarias.org/T/#m39b80d45d7d6cfc6b713284365c283579ac94cb1 --- lisp/org-agenda.el | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index fed36ac9b..94aea1b0a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -86,6 +86,8 @@ (declare-function org-add-archive-files "org-archive" (files)) (declare-function org-capture "org-capture" (&optional goto keys)) (declare-function org-clock-modify-effort-estimate "org-clock" (&optional value)) +(declare-function org-element-type "org-element" (&optional element)) + (defvar calendar-mode-map) (defvar org-clock-current-task) (defvar org-current-tag-alist) @@ -5729,7 +5731,8 @@ (defun org-agenda-get-timestamps (&optional deadlines) (org-at-planning-p) (org-before-first-heading-p) (and org-agenda-include-inactive-timestamps - (org-at-clock-log-p))) + (org-at-clock-log-p)) +(not (eq 'timestamp (org-element-type (org-element-context) (throw :skip nil)) (org-agenda-skip)) (let* ((pos (match-beginning 0)) -- 2.34.1
Haskell code blocks
Aloha all, Happy New Year! I'm struggling to write a minimal ob-doc-haskell.org for Worg. I installed Haskell via Spacemacs (development branch) and the Haskell installation appears to be functioning correctly. The obligatory Hello World! example yields bad results. #+name: haskell-hello-world #+begin_src haskell main :: IO () main = putStrLn "Hello, World!" main #+end_src #+RESULTS: haskell-hello-world : Prelude> Hello, World! I'm guessing the "Prelude>" part of the output is the prompt from the interpreter. I found this in ob-haskell.el: (setq-local comint-prompt-regexp (concat haskell-prompt-regexp "\\|^λ?> " But I couldn't find a way to modify haskell-prompt-regexp without changing the source. Advice welcome. All the best, Tom -- Thomas S. Dye https://tsdye.online/tsdye
Re: [PATCH] Re: Escaping org mode date properties
On Sun, Jan 02, 2022 at 10:51:54AM +0800, Ihor Radchenko wrote: > Eduardo Suarez-Santana writes: > > >> I am unable to reproduce. What are your Org and Emacs versions? > > > > I'm using Spacemacs (develop branch). > > > > - Emacs 27.2 > > - Org 9.5.1 > > > > I get a weird behaviour about it. These events appear when I start emacs. > > If I > > edit somehow these entries they disappear from the agenda view (until I > > start > > emacs again). > > Confirmed > > Thanks for the hint! I was able to reproduce entries disappearing from > agenda view. > > The culprit is org-in-src-block-p. It relies on fontification to > determine if we are inside a code block. However, when you strip a code > block with SCHEDULED inside from begin/end lines, the fontification > properties do not get removed. > > The attached patch should fix the issue. However, I need several people > to test it first - the patch will make things slower without cache. > The patch works for me. However, how about next cases? * an example block #+begin_example SCHEDULED: <2015-02-16 Mon .+2d> #+end_example * an example with colon : SCHEDULED: <2015-02-16 Mon .+2d> I think they behave the same way as 'begin_src'. > >> Depending what you want, you may use org-agenda-todo-list-sublevels or > >> add agenda filter excluding specific tags that you can then use to mark > >> undesired subtrees. > > > > Could be a workaround. Thanks a lot. > > > > Anyway it looks like a bug to me. > > For future. You will make things much easier if you provide a clear > sequence of steps to reproduce the problem. Your original report is not > reproducible if I just copy-paste your code into a new org file. I had > to guess what you did in order to see the problem. Sorry about that. I got weird results and was not sure about the expected behaviour. I had already asked in IRC with no answer.
Re: [PATCH] ob-shell-test, test-ob-shell and introduction
Aloha all, FWIW, as a user actively pursuing reproducible research with Org and a contributor to documentation about Org and Babel intended for other users (rather than Org mode elisp coders) I'd be pleased if Org's code custodians look favorably on this proposal. +1 All the best, Tom Matt writes: Apologies for the book. I've been sitting on this stuff for two months and am wondering how to proceed. IANAL but AFAIK/CT, my contract contains an exception for making contributions to projects like Org. I've gotten confirmation from my manager and by HR. However, until the CEO signs the FSF disclaimer, I can't officially contribute. I'm confident that I can publish changes (e.g. to a personal website); the FSF just can't accept my changes (yet). I could start working on ob-shell.el separately now and publish that myself. It's not clear how I would then contribute those changes back once I'm cleared by the FSF. I'm inclined towards some refactoring and I'm not sure how I could break that down in such a way that if it took two more months to get the copyright stuff worked out that anyone could make sense of the changes. I would much prefer to gradually submit patches, discuss them, and then eventually have them merged in turn. If I have a heap of changes elsewhere, I feel like it would be harder to have a conversion about them. Regardless, I think I should define test cases first. If those are considered valid, then any refactoring would be moot if they pass, right? With (agreed upon) test cases, it shouldn't matter if I refactor as long as functionality remains the same? Overall, what advice do you have? It looks to me like ob-shell.el could use some love in other respects besides async evaluation. I've detailed where below, partly for my own organization and partly for posterity, but mainly because this isn't my house, so to speak, and I don't want to barge in and start rearranging the furniture and eating whatever's in the fridge. Or, is it like Worg in that once I have the keys I can drive where I like, so long as there're no crashes? I'm interested in people's thoughts on these notes on ob-shell.el: * Tests There are several code paths, like shebang, cmdline, and basic execution, which don't always have something to do with one another in the code. Having tests would be really helpful to make sure everything jives. Before doing anything with the code base, I intend to create tests for all the functionality. * 2D-array I documented two options for the =:var= header[fn:1]. The ob-shell.el code actually defines a third option for 2D-arrays. I couldn't get it to work. It was one of several things not documented anywhere, at least as far as I could find, and which I had to figure out straight from the code. Between not being great at shell scripting and having a hard time deciphering that ob-shell.el code, I'm not sure 2D-arrays are actually fully or correctly implemented. * M-up behavior <> The =org-babel-load-session:shell= code path only works when M-up is used on a code block[fn:2]. Is M-up actually documented anywhere? Furthermore, the =org-babel-load-session:shell= only works for the "shell" language, which is not actually a "proper" shell (i.e. it's not listed in =org-babel-shell-names=). The M-up defaults to using $ESHELL or shell-file-name through the =shell= command. For example, try calling M-up on these: #+comment: (opaquely) calls the system shell #+begin_src shell :session my-shell echo "hello, world!" #+end_src #+comment: fails #+begin_src sh :session my-sh echo "hello, world!" #+end_src #+comment: fails #+begin_src bash :session my-bash echo "hello, world!" #+end_src To fix this, there needs to be an =org-babel-load-session:= for each language in =org-babel-shell-names=. This would probably make the most sense in =org-babel-shell-initialize=. However, that function [[org-babel-shell-initialize][needs attention]]. * Refactoring <> The ob-shell.el code appears inconsistent to me. Clearly, this is somewhat subjective. I've tried to give a rationale for each point to make it less so. My goal is to be maintainer of ob-shell.el, but that's not forever. These things were an obstacle for me and my aim is to remove them for the next person. ** =org-babel-shell-initialize= <> As alluded to elsewhere, =org-babel-shell-initialize= doesn't appear to adhere to the (elisp) Coding Conventions, #+begin_quote • Constructs that define a function or variable should be macros, not functions, and their names should start with ‘define-’. The macro should receive the name to be defined as the first argument. That will help various tools find the definition automatically. Avoid constructing the names in the macro itself, since that would confuse these tools. #+end_quote The =org-babel-shell-initialize= function defines =org-babel-execute:=, =org-babel-variable-assignments:=
Re: org-store-link does not work in gnus article mode (messages)
>>> "KM" == Kyle Meyer writes: > Uwe Brauer writes: >> Hi >> >> I thought this worked a while ago, but in a gnus article buffer I tried to >> use org-store-link and received >> >> (Running Emacs Master and org-mode master (some weeks old)) >> >> Debugger entered--Lisp error: (void-function org-fixup-message-id-for-http) >> org-fixup-message-id-for-http("8ad92378cff625ebc8020dc45afdaadef484a3a3.ca...@web.de") > org-fixup-message-id-for-http was removed from Org before the 9.3 > release (more specifically a486d9c, 2019-03-10) so your assumption that > a recent Org is at the front of your load-path is invalid. It is, but F... There is also another path to a directory that contains old versions of org mode, great, what a stupid mistakes. Thanks smime.p7s Description: S/MIME cryptographic signature
Re: org-store-link does not work in gnus article mode (messages)
Uwe Brauer writes: > Hi > > I thought this worked a while ago, but in a gnus article buffer I tried to > use org-store-link and received > > (Running Emacs Master and org-mode master (some weeks old)) > > Debugger entered--Lisp error: (void-function org-fixup-message-id-for-http) > > org-fixup-message-id-for-http("8ad92378cff625ebc8020dc45afdaadef484a3a3.ca...@web.de") org-fixup-message-id-for-http was removed from Org before the 9.3 release (more specifically a486d9c, 2019-03-10) so your assumption that a recent Org is at the front of your load-path is invalid.
Re: [patch] improved: add TTL as defcustom to ox-icalendar
Improved patch since org-icalendar-template needed to use the new variable, too. And now based on 9.5.2 from elpa. Detlef Am Thu, 30 Dec 2021 22:59:19 +0100 schrieb Detlef Steuer : > This is my first try ever to contribute anything in elisp. > > The nextcloud calendar app supports the X-PUBLISHED-TTL > option if subscribing to an ics file. Nextcloud defaults > to a TTL of 1 week, what is much too long for my use case. > > When exporting to such a file from org I did not find any way > to set this option during export. So I tried to add a defcustom > in ox-icalendar.el. > > The default TTL in this patch is 1 hour. > > I think this qualifies as an tiny patch, as it is mostly a docstring > :-), in case anybody finds this an useful addition. > > The patch is relative to 9.5.1 from elpa. > > All comments very much appreciated. > > And a happy new year to you all > Detlef 267a268,280 > (defcustom org-icalendar-ttl "PT1H" > "The time to life for the exported calendar. > Subscribing clients to the exported ics file can derive the time interval > to read the file again from the server. One example of such a client is > the nextcloud calendar, which respects the setting of > X-PUBLISHED-TTL, i.e. X-PUBLISHED-TTL:PT1H . > > See https://icalendar.org/iCalendar-RFC-5545/3-8-2-5-duration.html > for a complete description of possiblee values of this option. I.e. > PT1H stands for 1 hour, PT0H27M34S for 0 hours, 27 minutes and 34 seconds." > :group 'org-export-icalendar > :type 'string) > 303c316,317 < (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled)) --- > (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled) > (:icalendar-ttl nil nil org-icalendar-ttl)) 830a845,846 >;; TTL >org-icalendar-ttl 833c849 < (defun org-icalendar--vcalendar (name owner tz description contents) --- > (defun org-icalendar--vcalendar (name owner tz description ttl contents) 835c851 < NAME, OWNER, TZ, DESCRIPTION and CONTENTS are all strings giving, --- > NAME, OWNER, TZ, DESCRIPTION, TTL and CONTENTS are all strings giving, 837c853,854 < used, a short description and the other components included." --- > used, a short description, the time-to-live resp. refresh period and > the other components included." 843a861 > X-PUBLISHED-TTL:%s 848c866,867 < (org-icalendar-cleanup-string description)) --- > (org-icalendar-cleanup-string description) > (org-icalendar-cleanup-string ttl)) 976a996 > org-icalendar-ttl 1000a1021,1022 > ;; TTL (Refresh period) > org-icalendar-ttl
[PATCH] make test: Make failure results more verbose
Hi, In newer Emacs, ERT is capable of providing more info about FAILED tests. Maybe we can enable this option by default in the Org test suite? Best, Ihor >From 5e78a588a73871e54177080b3a6c9667f97500be Mon Sep 17 00:00:00 2001 Message-Id: <5e78a588a73871e54177080b3a6c9667f97500be.1641129033.git.yanta...@gmail.com> From: Ihor Radchenko Date: Sun, 2 Jan 2022 21:08:11 +0800 Subject: [PATCH] make test: Make failure results more verbose * mk/default.mk: New option BTEST_ERT_VERBOSE controlling verbosity of ERT results. The new default is verbose. * mk/targets.mk (check test test-dirty): Obey BTEST_ERT_VERBOSE Starting from https://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?id=8be9d4a1568c34aed753b085d5d33daef5dfa797 ERT can output more verbose failure results. More verbose sounds like a better default. --- mk/default.mk | 2 ++ mk/targets.mk | 4 2 files changed, 6 insertions(+) diff --git a/mk/default.mk b/mk/default.mk index c8a15bdd2..c49950c04 100644 --- a/mk/default.mk +++ b/mk/default.mk @@ -32,6 +32,8 @@ TMPDIR ?= /tmp testdir = $(TMPDIR)/tmp-orgtest # Configuration for testing +# setup ERT vebosity +BTEST_ERT_VERBOSE = yes # add options before standard load-path BTEST_PRE = # add options after standard load path diff --git a/mk/targets.mk b/mk/targets.mk index 6de77b1e6..937bb82bc 100644 --- a/mk/targets.mk +++ b/mk/targets.mk @@ -103,7 +103,11 @@ vanilla: check test:: compile check test test-dirty:: -$(MKDIR) $(testdir) +ifeq ($(BTEST_ERT_VERBOSE),yes) + TMPDIR=$(testdir) EMACS_TEST_VERBOSE=yes $(BTEST) +else TMPDIR=$(testdir) $(BTEST) +endif ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection $(MAKE) cleantest endif -- 2.34.1
Re: org-journal key-bind confusion
I've changed the kbd for org-journal-new-entry to "C-c j". Simpler too. Thanks. Best wishes, Colin -
Re: org-journal key-bind confusion
Thank you for the reply. > Ihor Radchenko writes: > Colin Baxter 😺 writes: >> There appears to be confusion between "org-journal-new-entry" and >> "org-goto". My ME is: >> >> 1. emacs -Q (I used emacs-29.0.50) 2. M-x load-library >> 3. /path/to/org-journal.el 4. C-h c 5. C-c C-j >> 6. "C-c C-j runs the command org-journal-new-entry" 7. Create an >> org file (say "test.org") from C-x C-f 8. C-h c 9. C-c C-j >> 10. "C-c C-j runs the command org-goto" > Note that org-journal is not a part of Org. From a quick glance > at the source code, C-c C-j for org-journal only works in > org-journal-mode. Yes, that is correct. > I do not see anything wrong on Org side. Moreover, this issue is > explicitly mentioned in > https://github.com/bastibe/org-journal#some-key-bindings-in-org-journal-conflict-with-org-mode-key-bindings I didn't know of the URL mentioning the issue, thanks. Best wishes, Colin -
Re: org-journal key-bind confusion
Colin Baxter 😺 writes: > There appears to be confusion between "org-journal-new-entry" and > "org-goto". My ME is: > > 1. emacs -Q (I used emacs-29.0.50) > 2. M-x load-library > 3. /path/to/org-journal.el > 4. C-h c > 5. C-c C-j > 6. "C-c C-j runs the command org-journal-new-entry" > 7. Create an org file (say "test.org") from C-x C-f > 8. C-h c > 9. C-c C-j > 10. "C-c C-j runs the command org-goto" Note that org-journal is not a part of Org. >From a quick glance at the source code, C-c C-j for org-journal only works in org-journal-mode. I do not see anything wrong on Org side. Moreover, this issue is explicitly mentioned in https://github.com/bastibe/org-journal#some-key-bindings-in-org-journal-conflict-with-org-mode-key-bindings Best, Ihor
[SOLVED] Re: How to auto insert inline image link for org-plot/gnuplot result plot?
I write an advice for this. #+begin_src emacs-lisp ;; `org-plot/gnuplot' advice of auto insert org gnuplot result image file. (advice-add 'org-plot/gnuplot :around #'org-plot/gnuplot-insert-org-image-link) (defun org-plot/gnuplot-insert-org-image-link (origin-func &rest args) "Auto insert `org-plot/gnuplot' generated plot image file link." (save-excursion (org-plot/goto-nearest-table) ;; Set default options. (setf params nil) (dolist (pair org-plot/gnuplot-default-options) (unless (plist-member params (car pair)) (setf params (plist-put params (car pair) (cdr pair) ;; Collect options. (while (and (equal 0 (forward-line -1)) (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params (setf param-file (plist-get params :file)) (apply origin-func args) (goto-char (org-table-end)) (org-indent-line) (insert (format "\n")) (org-indent-line) (insert (format "[[%s][%s]]" (expand-file-name param-file) param-file)) (org-indent-line) (insert (format "\n")) (when org-startup-with-inline-images (org-redisplay-inline-images))) #+end_src I suggest `org-plot.el` library can support this feature. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Sun, Jun 18, 2017 at 1:55 PM numbch...@gmail.com wrote: > I want to auto insert inline image for `org-plot/gnuplot` result plot > below the table. Like this: > > ```org > #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange > [0:]" > | Sede | Max cites | H-index | > |---+---+-| > | Chile |257.72 | 21.39 | > | Leeds |165.77 | 19.68 | > | Sao Paolo | 71.00 | 11.50 | > | Stockholm |134.19 | 14.33 | > | Morelia |257.56 | 17.67 | > > Press =[C-c " g]= on upper table to generate gnuplot plot image (*NOTE*: > the > generated plot image is in currently working directory). > > #+ATTR_ORG: :width 250 > #+ATTR_LATEX: :width 2.5in > #+ATTR_HTML: :width 250px > [[file:org-plot.png]] > ``` > > I have an idea, add an advice on `org-plot/gnuplot` with a user helper > function to inser the inline image link. > This advice need to: > > - locate point below the table. > - get the `org-plot/gnuplot` result plot image link. > - insert inline image link. > > [stardiviner] GPG key ID: 47C32433 > IRC(freeenode): stardiviner Twitter: @numbchild > Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 > Blog: http://stardiviner.github.io/ >