emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Grant Rettke <gcr@wisdomandwonder.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ox-koma-letter.el: Add support for url variable
Date: Thu, 13 Jul 2017 20:33:43 -0500	[thread overview]
Message-ID: <CAAjq1mcMC97PHNgSbqH-0298sFw1qqMuYSG6MS5rcoNzrAnwdw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

On Wed, Jan 4, 2017 at 4:57 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 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'.

Gotcha. Attached.

[-- Attachment #2: 0001-ox-koma-letter.el-Add-support-for-url-variable.patch --]
[-- Type: application/octet-stream, Size: 5067 bytes --]

From ba9e9f14fdfc6afd9a8214d8a40f4bf724e2bdb4 Mon Sep 17 00:00:00 2001
From: Grant Rettke <gcr@wisdomandwonder.com>
Date: Thu, 13 Jul 2017 20:14:52 -0500
Subject: [PATCH] ox-koma-letter.el: Add support for url variable

* contrib/lisp/ox-koma-letter.el (org-koma-letter-url, org-koma-letter-use-url, org-koma-letter--build-settings): Add support for url variable

Copied phone-number variable code, pasted it and changed references from phone-number to url.

Tested "url" with "#+URL: url", and "use-url" using "#+OPTIONS url:[nil|t]".

TINYCHANGE
---
 contrib/lisp/ox-koma-letter.el | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 37da54cbb..b87681b02 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -39,6 +39,7 @@
 ;;   - LCO: see `org-koma-letter-class-option-file',
 ;;   - OPENING: see `org-koma-letter-opening',
 ;;   - PHONE_NUMBER: see `org-koma-letter-phone-number',
+;;   - URL: see `org-koma-letter-url',
 ;;   - SIGNATURE: see `org-koma-letter-signature',
 ;;   - PLACE: see `org-koma-letter-place',
 ;;   - LOCATION: see `org-koma-letter-location',
@@ -57,6 +58,7 @@
 ;;   - backaddress (see `org-koma-letter-use-backaddress')
 ;;   - foldmarks (see `org-koma-letter-use-foldmarks')
 ;;   - phone (see `org-koma-letter-use-phone')
+;;   - url (see `org-koma-letter-use-url')
 ;;   - email (see `org-koma-letter-use-email')
 ;;   - place (see `org-koma-letter-use-place')
 ;;   - location (see `org-koma-letter-use-location')
@@ -184,6 +186,12 @@ This option can also be set with the PHONE_NUMBER keyword."
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-url ""
+  "Sender's URL, e. g., the URL of her homepage.
+This option can also be set with the URL keyword."
+  :group 'org-export-koma-letter
+  :type 'string)
+
 (defcustom org-koma-letter-place ""
   "Place from which the letter is sent, as a string.
 This option can also be set with the PLACE keyword."
@@ -362,6 +370,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-email nil
   "Non-nil prints sender's email address.
 This option can also be set with the OPTIONS keyword, e.g.:
@@ -426,6 +441,7 @@ e.g. \"title-subject:t\"."
     (:author-changed-in-buffer-p "AUTHOR" nil nil t)
     (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
     (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
+    (:url "URL" nil org-koma-letter-url)
     (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t)
     (:to-address "TO_ADDRESS" nil nil newline)
     (:place "PLACE" nil org-koma-letter-place)
@@ -445,6 +461,7 @@ e.g. \"title-subject:t\"."
     (:with-email nil "email" org-koma-letter-use-email)
     (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks)
     (:with-phone nil "phone" org-koma-letter-use-phone)
+    (:with-url nil "url" org-koma-letter-use-url)
     (:with-place nil "place" org-koma-letter-use-place)
     (:with-subject nil "subject" org-koma-letter-subject-format)
     (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject)
@@ -456,6 +473,7 @@ e.g. \"title-subject:t\"."
     (:inbuffer-from "FROM" nil 'koma-letter:empty)
     (:inbuffer-email "EMAIL" nil 'koma-letter:empty)
     (:inbuffer-phone-number "PHONE_NUMBER" nil 'koma-letter:empty)
+    (:inbuffer-url "URL" nil 'koma-letter:empty)
     (:inbuffer-place "PLACE" nil 'koma-letter:empty)
     (:inbuffer-location "LOCATION" nil 'koma-letter:empty)
     (:inbuffer-signature "SIGNATURE" nil 'koma-letter:empty)
@@ -463,6 +481,7 @@ e.g. \"title-subject:t\"."
     (:inbuffer-with-email nil "email" 'koma-letter:empty)
     (:inbuffer-with-foldmarks nil "foldmarks" 'koma-letter:empty)
     (:inbuffer-with-phone nil "phone" 'koma-letter:empty)
+    (:inbuffer-with-url nil "url" 'koma-letter:empty)
     (:inbuffer-with-place nil "place" 'koma-letter:empty))
   :translate-alist '((export-block . org-koma-letter-export-block)
 			(export-snippet . org-koma-letter-export-snippet)
@@ -757,6 +776,14 @@ a communication channel."
      (and (funcall check-scope 'with-phone)
           (format "\\KOMAoption{fromphone}{%s}\n"
                   (if (plist-get info :with-phone) "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")))
      ;; Signature.
      (let* ((heading-val
 	     (and (plist-get info :with-headline-opening)
-- 
2.13.3


             reply	other threads:[~2017-07-14  1:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14  1:33 Grant Rettke [this message]
2017-07-14  9:26 ` [PATCH] ox-koma-letter.el: Add support for url variable Nicolas Goaziou

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAjq1mcMC97PHNgSbqH-0298sFw1qqMuYSG6MS5rcoNzrAnwdw@mail.gmail.com \
    --to=gcr@wisdomandwonder.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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 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).