* [PATCH] ox-koma-letter.el: Add support for fromurl variable
@ 2017-01-04 22:10 Grant Rettke
2017-01-04 22:57 ` Nicolas Goaziou
2017-01-09 9:42 ` Rasmus
0 siblings, 2 replies; 4+ messages in thread
From: Grant Rettke @ 2017-01-04 22:10 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
Good morning,
I want to use the fromurl variable in KOMA so I copied how the phone
variable works.
The next change that I want to make is to include the description for
the fromurl like this:
\setkomavar{fromurl}[description]{content}
I haven't figured out how to do that yet.
Maybe the simplest thing is to let the user define it as a list with
url and description like this:
#+URL (url description)
The code can check if it a list or not when it generates the LaTeX code.
If this patch is accepted then I will figure out how to update Worg
with the fromurl variable.
[-- Attachment #2: 0001-ox-koma-letter.el-Add-support-for-fromurl-variable.patch --]
[-- Type: application/octet-stream, Size: 3749 bytes --]
From 9b69daad951f3a508fe2a92464e0ebc5e3a5643d Mon Sep 17 00:00:00 2001
From: Grant Rettke <gcr@wisdomandwonder.com>
Date: Wed, 4 Jan 2017 15:32:02 -0600
Subject: [PATCH] ox-koma-letter.el: Add support for fromurl variable
* contrib/lisp/ox-koma-letter.el (org-koma-letter-url, org-koma-letter-use-url, org-koma-letter--build-settings): Add support for fromurl variable
Copied email variable code, pasted it and changed references from email to url.
Tested "url" with "#+URL: url" and "use-url" using "#+OPTIONS url:[nil|t]".
TINYCHANGE
---
contrib/lisp/ox-koma-letter.el | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 801ab7dad..806fa038b 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -58,6 +58,7 @@
;; - foldmarks (see `org-koma-letter-use-foldmarks')
;; - phone (see `org-koma-letter-use-phone')
;; - email (see `org-koma-letter-use-email')
+;; - url (see `org-koma-letter-use-url')
;; - place (see `org-koma-letter-use-place')
;; - location (see `org-koma-letter-use-location')
;; - subject, a list of format options
@@ -171,6 +172,12 @@ This option can also be set with the EMAIL keyword."
(function)
(const :tag "Do not export email" nil)))
+(defcustom org-koma-letter-url ""
+ "Sender's URL, as a string.
+This option can also be set with the URL keyword."
+ :group 'org-export-koma-letter
+ :type 'string)
+
(defcustom org-koma-letter-from-address ""
"Sender's address, as a string.
This option can also be set with one or more FROM_ADDRESS
@@ -369,6 +376,13 @@ This option can also be set with the OPTIONS keyword, e.g.:
:group 'org-export-koma-letter
:type 'boolean)
+(defcustom org-koma-letter-use-url nil
+ "Non-nil prints sender's URL.
+This option can also be set with the OPTIONS keyword, e.g.:
+\"url:t\"."
+ :group 'org-export-koma-letter
+ :type 'boolean)
+
(defcustom org-koma-letter-use-place t
"Non-nil prints the letter's place next to the date.
This option can also be set with the OPTIONS keyword, e.g.:
@@ -427,6 +441,7 @@ e.g. \"title-subject:t\"."
(:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
(:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
(:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t)
+ (:url "URL" nil org-koma-letter-url)
(:to-address "TO_ADDRESS" nil nil newline)
(:place "PLACE" nil org-koma-letter-place)
(:location "LOCATION" nil org-koma-letter-location)
@@ -443,6 +458,7 @@ e.g. \"title-subject:t\"."
org-koma-letter-special-tags-after-letter)
(:with-backaddress nil "backaddress" org-koma-letter-use-backaddress)
(:with-email nil "email" org-koma-letter-use-email)
+ (:with-url nil "url" org-koma-letter-use-url)
(:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks)
(:with-phone nil "phone" org-koma-letter-use-phone)
(:with-place nil "place" org-koma-letter-use-place)
@@ -749,6 +765,14 @@ a communication channel."
(and (funcall check-scope 'with-email)
(format "\\KOMAoption{fromemail}{%s}\n"
(if (plist-get info :with-email) "true" "false")))
+ ;; URL
+ (let ((url (plist-get info :url)))
+ (and (org-string-nw-p url)
+ (funcall check-scope 'url)
+ (format "\\setkomavar{fromurl}{%s}\n" url)))
+ (and (funcall check-scope 'with-url)
+ (format "\\KOMAoption{fromurl}{%s}\n"
+ (if (plist-get info :with-url) "true" "false")))
;; Phone number.
(let ((phone-number (plist-get info :phone-number)))
(and (org-string-nw-p phone-number)
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for fromurl variable
2017-01-04 22:10 [PATCH] ox-koma-letter.el: Add support for fromurl variable Grant Rettke
@ 2017-01-04 22:57 ` Nicolas Goaziou
2017-01-09 9:42 ` Rasmus
1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2017-01-04 22:57 UTC (permalink / raw)
To: Grant Rettke; +Cc: emacs-orgmode@gnu.org
Hello,
Grant Rettke <gcr@wisdomandwonder.com> writes:
> The next change that I want to make is to include the description for
> the fromurl like this:
>
> \setkomavar{fromurl}[description]{content}
>
> I haven't figured out how to do that yet.
What is "description" supposed to do?
> Subject: [PATCH] ox-koma-letter.el: Add support for fromurl variable
Thank you.
You need to add :inbuffer-url and :inbuffer-with-url keywords. See,
e.g., `:inbuffer-phone-number' and `:inbuffer-with-phone'.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for fromurl variable
2017-01-04 22:10 [PATCH] ox-koma-letter.el: Add support for fromurl variable Grant Rettke
2017-01-04 22:57 ` Nicolas Goaziou
@ 2017-01-09 9:42 ` Rasmus
2017-07-14 1:39 ` Grant Rettke
1 sibling, 1 reply; 4+ messages in thread
From: Rasmus @ 2017-01-09 9:42 UTC (permalink / raw)
To: emacs-orgmode
Hi Grant,
Thanks for the patch.
Grant Rettke <gcr@wisdomandwonder.com> writes:
> I want to use the fromurl variable in KOMA so I copied how the phone
> variable works.
>
> The next change that I want to make is to include the description for
> the fromurl like this:
>
> \setkomavar{fromurl}[description]{content}
>
> I haven't figured out how to do that yet.
At the moment there's no direct support for [description] for any
variables in KOMA letters generated through Org. What is the use-case
here?
The default description is "Url" and it does not have a corresponding
"symbolicname".
In general, descriptors are used in headers or footers which would
typically be set up in a separate LCO file, I’d guess. E.g.
\ifkomavarempty{fromurl}{}{\usekomavar*{fromurl}\usekomavar{fromurl}}
> Maybe the simplest thing is to let the user define it as a list with
> url and description like this:
This should be done for all komavars if it was to be added IMO.
Thanks,
Rasmus
--
Hooray!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for fromurl variable
2017-01-09 9:42 ` Rasmus
@ 2017-07-14 1:39 ` Grant Rettke
0 siblings, 0 replies; 4+ messages in thread
From: Grant Rettke @ 2017-07-14 1:39 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode@gnu.org
On Mon, Jan 9, 2017 at 3:42 AM, Rasmus <rasmus@gmx.us> wrote:
> The default description is "Url" and it does not have a corresponding
> "symbolicname".
>
> In general, descriptors are used in headers or footers which would
> typically be set up in a separate LCO file, I’d guess. E.g.
>
> \ifkomavarempty{fromurl}{}{\usekomavar*{fromurl}\usekomavar{fromurl}}
I set it in the LCO file like this
\setkomavar{fromurl}{\href{the ur}{the description}}
And then enable/disable or override it in the Org document.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-14 1:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 22:10 [PATCH] ox-koma-letter.el: Add support for fromurl variable Grant Rettke
2017-01-04 22:57 ` Nicolas Goaziou
2017-01-09 9:42 ` Rasmus
2017-07-14 1:39 ` Grant Rettke
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).