From: Grant Rettke <gcr@wisdomandwonder.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] ox-koma-letter.el: Add support for fromurl variable
Date: Wed, 4 Jan 2017 16:10:10 -0600 [thread overview]
Message-ID: <CAAjq1me1sNih800nms8UgAWyPvDuVGre0Xueg8ih+TDVtrM+Zw@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2017-01-04 22:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 22:10 Grant Rettke [this message]
2017-01-04 22:57 ` [PATCH] ox-koma-letter.el: Add support for fromurl variable Nicolas Goaziou
2017-01-09 9:42 ` Rasmus
2017-07-14 1:39 ` Grant Rettke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAjq1me1sNih800nms8UgAWyPvDuVGre0Xueg8ih+TDVtrM+Zw@mail.gmail.com \
--to=gcr@wisdomandwonder.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.