Switching over from package org-radiobutton to native support
So I found out that there is now native support for radio-button style selects and I have tested it and it seems to work well. However I am missing a function similar to `org-radiobutton-value`: https://github.com/Fuco1/org-radiobutton/blob/master/org-radiobutton.el#L111-L121 That will return the value of the currently selected checkbox by the attached name. So for example: #+ATTR_ORG: :radio t #+NAME: named_radio_value - [ ] Value A - [X] Value B - [ ] Value C Would return `Value B` for `named_radio_value`. This is useful when creating interfaces in Org Mode and acting on those. I know it is possible via a mouthful of lisp. But it would be nice if it was natively supported. It would also be nice if this also worked for normal lists, e.g. having the possibility to easily extract all selected values. What do you think? Is something like this already implemented, but I missed it? Best regards, Terje Larsen
Re: [PATCH] ob-plantuml: Support for plantuml as well as the current java+jar solution
Did this look okay? I've had to rebase this once again due to some conflicts in the ORG-NEWS. Find the latest patch attached. Best regards Terje On Tue, Jun 9, 2020 at 8:53 AM Terje Larsen wrote: > > Thank you Bastien, > > I didn't get what the updated patch with shorter lines meant, the only > thing I could see difference between that patch and my previous patch > was the line breaks using CR LF instead of LF. I generate my patch > with git format-patch > > Here is the updated patch using mapconcat. > > Best regards > Terje > > On Mon, Jun 1, 2020 at 4:00 PM Bastien wrote: > > > > Hello Terje, > > > > > I have now signed the FSF papers. Here is the updated patch on top of > > > current master. > > > > Great, thanks. > > > > > Let me know if all looks good or if I need to make further changes or > > > need to provide something else. > > > > It looks good -- here is an updated patch with shorter lines. > > > > The last change you need to make is to use mapconcat instead > > of string-join, which would require us to load subr-x.el. > > > > Once this is done I'll apply your patch. > > > > Thanks, > > > > -- > > Bastien > > > > -- > // Terje Larsen -- // Terje Larsen From d2d73cd6dce1576d7396f734c70657f9a9e1806f Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Fri, 8 Nov 2019 10:25:49 +0100 Subject: [PATCH] ob-plantuml: Add support for plantuml executable * lisp/ob-plantuml (org-babel-variable-assignments:plantuml): Support using plantuml executable instead of jar. Some systems come with an executable for plantuml instead of a specific JAR file. This adds support for two different modes: - jar :: using java together with a JAR (previous behavior) - plantuml :: using a PlantUML executable The PlantUML executable can be configured via `org-plantuml-executable-path` and also the arguments that will be given via `org-plantuml-executable-args`. --- etc/ORG-NEWS| 7 lisp/ob-plantuml.el | 94 + 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 10658a970..87c5696d8 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -266,6 +266,13 @@ can now be inserted with this prefix argument. Source code block header argument =:file-mode= can set file permissions if =:file= argument is provided. +*** =ob-plantuml=: now supports using PlantUML executable to generate diagrams + +Set =org-plantuml-exec-mode= to ='plantuml= in order to use the +executable instead of JAR. When using an executable it is also +possible to configure executable location as well as arguments via: +=org-plantuml-executable-path= and =org-plantuml-executable-args=. + ** New commands *** ~org-table-header-line-mode~ diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index 0e1d4eda2..4d10a68f4 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -31,7 +31,7 @@ ;;; Requirements: ;; plantuml | http://plantuml.sourceforge.net/ -;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file +;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar') ;;; Code: (require 'ob) @@ -46,6 +46,31 @@ :version "24.1" :type 'string) +(defcustom org-plantuml-exec-mode 'jar + "Method to use for PlantUML diagram generation. +`jar' means to use java together with the JAR. +The JAR can be configured via `org-plantuml-jar-path'. + +`plantuml' means to use the PlantUML executable. +The executable can be configured via `org-plantuml-executable-path'. +You can also configure extra arguments via `org-plantuml-executable-args'." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'symbol + :options '(jar plantuml)) + +(defcustom org-plantuml-executable-path "plantuml" + "File name of the PlantUML executable." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'string) + +(defcustom org-plantuml-executable-args (list "-headless") + "The arguments passed to plantuml executable when executing PlantUML." + :group 'org-babel + :package-version '(Org . "9.4") + :type '(repeat string)) + (defun org-babel-variable-assignments:plantuml (params) "Return a list of PlantUML statements assigning the block's variables. PARAMS is a property list of source block parameters, which may @@ -83,40 +108,41 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assq :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) (java (or (cdr (assq :java params)) "")) + (executable (c
Re: [PATCH] ob-plantuml: Support for plantuml as well as the current java+jar solution
Thank you Bastien, I didn't get what the updated patch with shorter lines meant, the only thing I could see difference between that patch and my previous patch was the line breaks using CR LF instead of LF. I generate my patch with git format-patch Here is the updated patch using mapconcat. Best regards Terje On Mon, Jun 1, 2020 at 4:00 PM Bastien wrote: > > Hello Terje, > > > I have now signed the FSF papers. Here is the updated patch on top of > > current master. > > Great, thanks. > > > Let me know if all looks good or if I need to make further changes or > > need to provide something else. > > It looks good -- here is an updated patch with shorter lines. > > The last change you need to make is to use mapconcat instead > of string-join, which would require us to load subr-x.el. > > Once this is done I'll apply your patch. > > Thanks, > > -- > Bastien -- // Terje Larsen From 5a26a6cf2783836bfa16e006607d06a911b97c56 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Fri, 8 Nov 2019 10:25:49 +0100 Subject: [PATCH] ob-plantuml: Add support for plantuml executable * lisp/ob-plantuml (org-babel-variable-assignments:plantuml): Support using plantuml executable instead of jar. Some systems come with an executable for plantuml instead of a specific JAR file. This adds support for two different modes: - jar :: using java together with a JAR (previous behavior) - plantuml :: using a PlantUML executable The PlantUML executable can be configured via `org-plantuml-executable-path` and also the arguments that will be given via `org-plantuml-executable-args`. --- etc/ORG-NEWS| 7 lisp/ob-plantuml.el | 94 + 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index f313b07fe..93695dd01 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -255,6 +255,13 @@ explicitly: In situations where ~org-return~ calls ~newline~, multiple newlines can now be inserted with this prefix argument. +*** =ob-plantuml=: now supports using PlantUML executable to generate diagrams + +Set =org-plantuml-exec-mode= to ='plantuml= in order to use the +executable instead of JAR. When using an executable it is also +possible to configure executable location as well as arguments via: +=org-plantuml-executable-path= and =org-plantuml-executable-args=. + ** New commands *** ~org-table-header-line-mode~ diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index 0e1d4eda2..4d10a68f4 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -31,7 +31,7 @@ ;;; Requirements: ;; plantuml | http://plantuml.sourceforge.net/ -;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file +;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar') ;;; Code: (require 'ob) @@ -46,6 +46,31 @@ :version "24.1" :type 'string) +(defcustom org-plantuml-exec-mode 'jar + "Method to use for PlantUML diagram generation. +`jar' means to use java together with the JAR. +The JAR can be configured via `org-plantuml-jar-path'. + +`plantuml' means to use the PlantUML executable. +The executable can be configured via `org-plantuml-executable-path'. +You can also configure extra arguments via `org-plantuml-executable-args'." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'symbol + :options '(jar plantuml)) + +(defcustom org-plantuml-executable-path "plantuml" + "File name of the PlantUML executable." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'string) + +(defcustom org-plantuml-executable-args (list "-headless") + "The arguments passed to plantuml executable when executing PlantUML." + :group 'org-babel + :package-version '(Org . "9.4") + :type '(repeat string)) + (defun org-babel-variable-assignments:plantuml (params) "Return a list of PlantUML statements assigning the block's variables. PARAMS is a property list of source block parameters, which may @@ -83,40 +108,41 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assq :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) (java (or (cdr (assq :java params)) "")) + (executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path) + (t "java"))) + (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args) +((string= "" org-plantuml-jar-path) + (error "`org-plantuml-jar-path' is not set")) +((not (file-exists-p org-plantuml-jar-path)) + (error "Could not find plantuml.jar at %s" org-plantuml-jar-
Re: [PATCH] ob-plantuml: Support for plantuml as well as the current java+jar solution
Hello Bastien, I have now signed the FSF papers. Here is the updated patch on top of current master. Let me know if all looks good or if I need to make further changes or need to provide something else. Best regards, Terje On Mon, Feb 17, 2020 at 12:29 AM Bastien wrote: > > Hi Terje, > > Terje Larsen writes: > > > You are welcome, I have never gotten around to sign the FSF papers as > > I thought it was a > > bit of a hassle, but with those clear instructions I have now started > > the process. > > Thanks! > > > I guess I have to wait until the process is done until I can > > resubmit? > > Yes, exactly. Thanks for contributing, > > -- > Bastien -- // Terje Larsen From b5f1bf735e6cf7eeeaa4f8bfdab921bed0959b46 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Fri, 8 Nov 2019 10:25:49 +0100 Subject: [PATCH] ob-plantuml: Add support for plantuml executable * lisp/ob-plantuml (org-babel-variable-assignments:plantuml): Support using plantuml executable instead of jar. Some systems come with an executable for plantuml instead of a specific JAR file. This adds support for two different modes: - jar :: using java together with a JAR (previous behavior) - plantuml :: using a PlantUML executable The PlantUML executable can be configured via `org-plantuml-executable-path` and also the arguments that will be given via `org-plantuml-executable-args`. --- etc/ORG-NEWS| 7 lisp/ob-plantuml.el | 94 + 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 5183b58de..0b161a32b 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -243,6 +243,13 @@ explicitly: In situations where ~org-return~ calls ~newline~, multiple newlines can now be inserted with this prefix argument. +*** =ob-plantuml=: now supports using PlantUML executable to generate diagrams + +Set =org-plantuml-exec-mode= to ='plantuml= in order to use the +executable instead of JAR. When using an executable it is also +possible to configure executable location as well as arguments via: +=org-plantuml-executable-path= and =org-plantuml-executable-args=. + ** New commands *** ~org-table-header-line-mode~ diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index 0e1d4eda2..67b469c31 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -31,7 +31,7 @@ ;;; Requirements: ;; plantuml | http://plantuml.sourceforge.net/ -;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file +;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar') ;;; Code: (require 'ob) @@ -46,6 +46,31 @@ :version "24.1" :type 'string) +(defcustom org-plantuml-exec-mode 'jar + "Method to use for PlantUML diagram generation. +`jar' means to use java together with the JAR. +The JAR can be configured via `org-plantuml-jar-path'. + +`plantuml' means to use the PlantUML executable. +The executable can be configured via `org-plantuml-executable-path'. +You can also configure extra arguments via `org-plantuml-executable-args'." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'symbol + :options '(jar plantuml)) + +(defcustom org-plantuml-executable-path "plantuml" + "File name of the PlantUML executable." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'string) + +(defcustom org-plantuml-executable-args (list "-headless") + "The arguments passed to plantuml executable when executing PlantUML." + :group 'org-babel + :package-version '(Org . "9.4") + :type '(repeat string)) + (defun org-babel-variable-assignments:plantuml (params) "Return a list of PlantUML statements assigning the block's variables. PARAMS is a property list of source block parameters, which may @@ -83,40 +108,41 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assq :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) (java (or (cdr (assq :java params)) "")) + (executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path) + (t "java"))) + (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args) +((string= "" org-plantuml-jar-path) + (error "`org-plantuml-jar-path' is not set")) +((not (file-exists-p org-plantuml-jar-path)) + (error "Could not find plantuml.jar at %s" org-plantuml-jar-path)) +(t (list java + "-jar" + (shell-quote-argument (expand-file-name org-plantuml-jar-path)) (full-body (org-babel-plantuml-make-body body params)) - (cmd (if (string= "
Re: [PATCH] ob-plantuml: Support for plantuml as well as the current java+jar solution
Thank you Bastien, You are welcome, I have never gotten around to sign the FSF papers as I thought it was a bit of a hassle, but with those clear instructions I have now started the process. I guess I have to wait until the process is done until I can resubmit? On Wed, Feb 12, 2020 at 6:31 PM Bastien wrote: > > Hi Terje, > > Terje Larsen writes: > > > I have been missing this feature for a while and noticed it had already > > been requested before (2014), See: > > https://lists.gnu.org/archive/html/emacs-orgmode/2016-08/msg00105.html > > > > With this patch you can switch between using jar or plantuml. The idea > > partly stemmed from plantuml-mode and my inability to use the default > > implementation. You can see the implementation for plantuml-mode here: > > https://github.com/skuro/plantuml-mode/pull/102/files > > > > My patch is available here: > > https://code.orgmode.org/terlar/org-mode/commit/fbe245c0b09513ee5a6d3b189e112708b9d08da0 > > Thanks for the patch -- I see you're already on the list of committers > with TINYCHANGE: https://orgmode.org/worg/org-contribute.html#orgcd077ac > > Would you like to sign the FSF papers and resubmit your patch on top > of current master? > > https://orgmode.org/request-assign-future.txt > > Thanks a lot, > > -- > Bastien -- // Terje Larsen
Support for something like org-image-max-width
There is already org-image-actual-width but the problem with that one is that images that have quite small width, but are tall will be scaled and become very tall. I think it would make sense to introduce something like org-image-max-width, which would scale images that are larger than this width, but leave images within this width alone. Another interesting thing would be to be able to adjust the max-width to the width of the buffer, but not sure how well that will play in all cases and how complex that would be. Any thoughts on this? Best regards, Terje Larsen
[PATCH] Add customization to fontify TODO headlines
This adds a feature similar to the org-fontify-done-headline, but instead for the TODO headlines. This is enabled with the boolean customization org-fontify-todo-headline and can be themed via the face org-headline-todo. I was missing this when I wanted to distinguish more clearly between the TODO headlines and the other headlines (more so than the highlighted TODO keyword(s)). Hope someone else finds this useful. Best regards, Terje Larsen >From 57dd1fca737794f4c20d439d1fbf288511b1e44f Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Sun, 1 Dec 2019 20:20:55 +0100 Subject: [PATCH] org: Add customization to fontify TODO headlines * lisp/org (org-fontify-todo-headline): Add new boolean customization to toggle this behavior. * lisp/org (org-set-font-lock-defaults): Apply face org-headline-todo to lines starting with keywords in org-not-done-keywords. * lisp/org-faces (org-headline-todo): Add new face to customize look of todo headlines. --- etc/ORG-NEWS | 5 + lisp/org-faces.el | 9 + lisp/org.el | 18 ++ 3 files changed, 32 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 689a07871..872cebf76 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -20,6 +20,11 @@ work also for this level. In other words; defining things in a property drawer before the first headline will make them "inheritable" for all headlines. +*** Fontify whole TODO headlines +This feature is the same as =org-fontify-done-headline=, but for TODO +headlines instead. This allows you to distinguish TODO headlines from +normal headlines. The face can be customized via =org-headline-todo=. + * Version 9.3 ** Incompatible changes diff --git a/lisp/org-faces.el b/lisp/org-faces.el index a97d4dc4a..416f49b52 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -243,6 +243,15 @@ is of course immediately visible, but for example a passed deadline is of the frame, for example." :group 'org-faces) +(defface org-headline-todo ;Copied from `font-lock-string-face' + 'class color) (min-colors 16) (background light)) (:foreground "Red4")) +(((class color) (min-colors 16) (background dark)) (:foreground "Pink2")) +(((class color) (min-colors 8) (background light)) (:bold t))) + "Face used to indicate that a headline is marked as TODO. +This face is only used if `org-fontify-todo-headline' is set. If applies +to the part of the headline after the TODO keyword." + :group 'org-faces) + (defface org-headline-done ;Copied from `font-lock-string-face' 'class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) diff --git a/lisp/org.el b/lisp/org.el index 20c263f74..53bc47641 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3686,6 +3686,15 @@ hide them with `org-toggle-custom-properties-visibility'." :version "24.3" :type '(repeat (string :tag "Property Name"))) +(defcustom org-fontify-todo-headline nil + "Non-nil means change the face of a headline if it is marked as TODO. +Normally, only the TODO/DONE keyword indicates the state of a headline. +When this is non-nil, the headline after the keyword is set to the +`org-headline-todo' as an additional indication." + :group 'org-appearance + :package-version '(Org . "9.4") + :type 'boolean) + (defcustom org-fontify-done-headline nil "Non-nil means change the face of a headline if it is marked DONE. Normally, only the TODO/DONE keyword indicates the state of a headline. @@ -5652,6 +5661,15 @@ needs to be inserted at a specific position in the font-lock sequence.") (list (format org-heading-keyword-regexp-format org-todo-regexp) '(2 (org-get-todo-face 2) t)) + ;; TODO + (if org-fontify-todo-headline + (list (format org-heading-keyword-regexp-format + (concat + "\\(?:" + (mapconcat 'regexp-quote org-not-done-keywords "\\|") + "\\)")) + '(2 'org-headline-todo t)) + nil) ;; DONE (if org-fontify-done-headline (list (format org-heading-keyword-regexp-format -- 2.24.0
Re: [PATCH] ob-plantuml: Support for plantuml as well as the current java+jar solution
Nicolas Goaziou writes: Hello and thank you for the feedback, made me learn a few things and make some improvements. I have made the suggested changes (see attachment). >From e3c46993714234c0290f3100683cbec3c0d5f056 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Fri, 8 Nov 2019 10:25:49 +0100 Subject: [PATCH] ob-plantuml: Add support for plantuml executable * lisp/ob-plantuml (org-babel-variable-assignments:plantuml): Support using plantuml executable instead of jar. Some systems come with an executable for plantuml instead of a specific JAR file. This adds support for two different modes: - jar :: using java together with a JAR (previous behavior) - plantuml :: using a PlantUML executable The PlantUML executable can be configured via `org-plantuml-executable-path` and also the arguments that will be given via `org-plantuml-executable-args`. --- etc/ORG-NEWS| 5 +++ lisp/ob-plantuml.el | 94 + 2 files changed, 65 insertions(+), 34 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 689a07871..2cce7dd41 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -19,6 +19,11 @@ just as if it was at outline level 0. Inheritance for properties will work also for this level. In other words; defining things in a property drawer before the first headline will make them "inheritable" for all headlines. +*** Babel + ob-plantuml now supports using PlantUML executable to generate diagrams +Set =org-plantuml-exec-mode= to ='plantuml= in order to use the +executable instead of JAR. Executable mode can be configured via: +=org-plantuml-executable-path= and =org-plantuml-executable-args=. * Version 9.3 diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index 09c9a3334..aeea1802f 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -31,7 +31,7 @@ ;;; Requirements: ;; plantuml | http://plantuml.sourceforge.net/ -;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file +;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar') ;;; Code: (require 'ob) @@ -46,6 +46,31 @@ :version "24.1" :type 'string) +(defcustom org-plantuml-exec-mode 'jar + "Method to use for PlantUML diagram generation. +`jar' means to use java together with the JAR. +The JAR can be configured via `org-plantuml-jar-path'. + +`plantuml' means to use the PlantUML executable. +The executable can be configured via `org-plantuml-executable-path'. +You can also configure extra arguments via `org-plantuml-executable-args'." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'symbol + :options '(jar plantuml)) + +(defcustom org-plantuml-executable-path "plantuml" + "File name of the PlantUML executable." + :group 'org-babel + :package-version '(Org . "9.4") + :type 'string) + +(defcustom org-plantuml-executable-args (list "-headless") + "The arguments passed to plantuml executable when executing PlantUML." + :group 'org-babel + :package-version '(Org . "9.4") + :type '(repeat string)) + (defun org-babel-variable-assignments:plantuml (params) "Return a list of PlantUML statements assigning the block's variables. PARAMS is a property list of source block parameters, which may @@ -82,40 +107,41 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assq :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) (java (or (cdr (assq :java params)) "")) + (executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path) + (t "java"))) + (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args) +((string= "" org-plantuml-jar-path) + (error "`org-plantuml-jar-path' is not set")) +((not (file-exists-p org-plantuml-jar-path)) + (error "Could not find plantuml.jar at %s" org-plantuml-jar-path)) +(t (list java + "-jar" + (shell-quote-argument (expand-file-name org-plantuml-jar-path)) (full-body (org-babel-plantuml-make-body body params)) - (cmd (if (string= "" org-plantuml-jar-path) - (error "`org-plantuml-jar-path' is not set") - (concat "java " java " -jar " - (shell-quote-argument - (expand-file-name org-plantuml-jar-path)) - (if (string= (file-name-extension out-file) "png") - " -tpng" "") - (if (string= (file-name-extension out-file) "svg") - " -tsvg" "") - (if (string= (file-name-extension out-file) "eps") - " -teps" "") - (if (string= (file-name-extension out-file)
[PATCH] ob-plantuml: Support for plantuml as well as the current java+jar solution
I have been missing this feature for a while and noticed it had already been requested before (2014), See: https://lists.gnu.org/archive/html/emacs-orgmode/2016-08/msg00105.html With this patch you can switch between using jar or plantuml. The idea partly stemmed from plantuml-mode and my inability to use the default implementation. You can see the implementation for plantuml-mode here: https://github.com/skuro/plantuml-mode/pull/102/files My patch is available here: https://code.orgmode.org/terlar/org-mode/commit/fbe245c0b09513ee5a6d3b189e112708b9d08da0 And also see attached within this mail. >From fbe245c0b09513ee5a6d3b189e112708b9d08da0 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Fri, 8 Nov 2019 10:25:49 +0100 Subject: [PATCH] ob-plantuml: Add support for plantuml executable * lisp/ob-plantuml (org-babel-variable-assignments:plantuml): Support using plantuml executable instead of jar. Some systems come with an executable for plantuml instead of a specific JAR file. This adds support for two different modes: - jar :: using java together with a JAR (previous behavior) - plantuml :: using a PlantUML executable The PlantUML executable can be configured via `org-plantuml-executable-path` and also the arguments that will be given via `org-plantuml-executable-args`. --- lisp/ob-plantuml.el | 94 + 1 file changed, 60 insertions(+), 34 deletions(-) diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index 09c9a3334..388d9f1b9 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -31,7 +31,7 @@ ;;; Requirements: ;; plantuml | http://plantuml.sourceforge.net/ -;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file +;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar') ;;; Code: (require 'ob) @@ -46,6 +46,31 @@ :version "24.1" :type 'string) +(defcustom org-plantuml-exec-mode 'jar + "Method to use for PlantUML diagram generation. +`jar' means to use java together with the JAR. +The JAR can be configured via `org-plantuml-jar-path'. + +`plantuml' means to use the PlantUML executable. +The executable can be configured via `org-plantuml-executable-path'. +You can also configure extra arguments via `org-plantuml-executable-args'." + :group 'org-babel + :version "24.1" + :type 'symbol + :options '(jar plantuml)) + +(defcustom org-plantuml-executable-path "plantuml" + "Path to the PlantUML executable." + :group 'org-babel + :version "24.1" + :type 'string) + +(defcustom org-plantuml-executable-args (list "-headless") + "The arguments passed to plantuml executable when executing PlantUML." + :group 'org-babel + :version "24.1" + :type '(repeat string)) + (defun org-babel-variable-assignments:plantuml (params) "Return a list of PlantUML statements assigning the block's variables. PARAMS is a property list of source block parameters, which may @@ -82,40 +107,41 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assq :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) (java (or (cdr (assq :java params)) "")) + (executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path) + (t "java"))) + (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args) +(t (cond ((string= "" org-plantuml-jar-path) + (error "`org-plantuml-jar-path' is not set")) + ((not (file-exists-p org-plantuml-jar-path)) + (error "Could not find plantuml.jar at %s" org-plantuml-jar-path)) + (t (list java + "-jar" + (shell-quote-argument + (expand-file-name org-plantuml-jar-path (full-body (org-babel-plantuml-make-body body params)) - (cmd (if (string= "" org-plantuml-jar-path) - (error "`org-plantuml-jar-path' is not set") - (concat "java " java " -jar " - (shell-quote-argument - (expand-file-name org-plantuml-jar-path)) - (if (string= (file-name-extension out-file) "png") - " -tpng" "") - (if (string= (file-name-extension out-file) "svg") - " -tsvg" "") - (if (string= (file-name-extension out-file) "eps") - " -teps" "") - (if (string= (file-name-extension out-file) "pdf") - " -tpdf" "") - (if (string= (file-name-extension out-file) "tex") - " -tlatex" "") - (if (string= (file-name-extension out-file) "vdx") - " -tvdx" "") - (if (string= (file-name-extension out-file)
Bug: ob-plantuml: using @start prefix in buffer returns nil body due to nil assignments [N/A (N/A @ /nix/store/1hmx5h1kn25p7s31h31dz7g3kn1dc6qx-emacs-packages-deps/share/emacs/site-lisp/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. I noticed that I cannot run C-c C-c to convert plantuml source blocks since the commit (4e854974be9788f029f2d73f829c4d51d2b83faf), see changes at: https://code.orgmode.org/bzg/org-mode/commit/4e854974be9788f029f2d73f829c4d51d2b83faf#diff-9c9a333463276ff17be763269a5042f92a40817R73 If I have a simple source block as such as: #+BEGIN_SRC plantuml :file output.png @startuml actor Foo1 actor Foo2 Foo1 -> Foo2 : Test @enduml #+END_SRC When I try to run C-c C-c I receive the following error message: org-babel-execute-src-block: Wrong type argument: char-or-string-p, nil During my debugging I found out that assignments inside the function org-babel-plantuml-make-body returns nil and that causes the function to return nil which is not expected behavior. I remember this working before, so I went looking through the history and noticed the addition of this code. To me it looks like the logic is wrong. As the expression: (org-babel-variable-assignments:plantuml params) Could not possibly not return the body and without the body the content will be invalid. I have verified that reverting this commit fixes the issue and lets me generate PlantUML files. Emacs : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12) Package: Org mode version N/A (N/A @ /nix/store/1hmx5h1kn25p7s31h31dz7g3kn1dc6qx-emacs-packages-deps/share/emacs/site-lisp/org/)
[O] Use Emacs support for image resizing when using org-image-actual-width
I am running Emacs version 27 (building from master) and recently noticed that my images no longer scales using org-image-actual-width. I then read that ImageMagick support is no longer enabled by default as there is a new "native" resizing method built-in to Emacs. As seen in the news for on Emacs version 27 (master branch): > ** Emacs no longer defaults to using ImageMagick to display images, > due to security and stability concerns. To override the default, use > 'configure --with-imagemagick'. As well as: > ** Emacs now supports resizing and rotating images without ImageMagick. > All modern systems support this feature. (On GNU and Unix systems, > Cairo drawing or the XRender extension to X11 is required for this to > be available; the configure script will test for it and, if found, > enable scaling.) > The new function 'image-transforms-p' can be used to test whether any > given frame supports these capabilities. I then inspected the code of org-mode and noticed there is an expression in the cond that figures out how to scale, e.g.: > ((not (image-type-available-p 'imagemagick)) nil) I haven't looked into yet how the scaling is done, but I know some other modes such as image-mode had support for using the new method. I think it would be great to support the native scaling option as well when available. Since opting in to imagemagick will be Emacs wide and then we loose the benefit of the new functionality. Best regards, Terje Larsen