* Patch adding from-logo to ox-koma-letter.el
@ 2018-04-28 4:30 Grant Rettke
2018-04-28 4:34 ` Grant Rettke
2018-04-28 6:31 ` Bastien
0 siblings, 2 replies; 4+ messages in thread
From: Grant Rettke @ 2018-04-28 4:30 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 381 bytes --]
Hi,
This patch adds from-logo support to ox-koma-letter.el.
Tested it manually with Elisp and also in buffer properties. There are
four combinations (both in properties, both in Elisp, and then the two
permutations).
It was a copy-and-paste job so I marked it as a tinychange even though
it was more than 15 lines.
Ran the system tests and they pass.
Sincerely,
Grant Rettke
[-- Attachment #2: 0001-ox-koma-letter.el-Adds-from-logo-variable.patch --]
[-- Type: application/octet-stream, Size: 5090 bytes --]
From 6fc33a25c162d6c0e3651d25951cf60b517c1f48 Mon Sep 17 00:00:00 2001
From: Grant Rettke <gcr@wisdomandwonder.com>
Date: Fri, 27 Apr 2018 23:15:34 -0500
Subject: [PATCH] ox-koma-letter.el Adds from-logo variable
* ox-koma-letter.el (org-export-define-derived-backend, org-koma-letter--build-settings): Adds
from-logo handling and supporting variables
`org-koma-letter-from-logo' and `org-koma-letter-use-from-logo'.
TINYCHANGE
---
contrib/lisp/ox-koma-letter.el | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 37d7112cf..fec99bbdf 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -40,6 +40,7 @@
;; - OPENING: see `org-koma-letter-opening',
;; - PHONE_NUMBER: see `org-koma-letter-phone-number',
;; - URL: see `org-koma-letter-url',
+;; - FROM_LOGO: see `org-koma-letter-from-logo',
;; - SIGNATURE: see `org-koma-letter-signature',
;; - PLACE: see `org-koma-letter-place',
;; - LOCATION: see `org-koma-letter-location',
@@ -59,6 +60,7 @@
;; - foldmarks (see `org-koma-letter-use-foldmarks')
;; - phone (see `org-koma-letter-use-phone')
;; - url (see `org-koma-letter-use-url')
+;; - from-logo (see `org-koma-letter-use-from-logo')
;; - email (see `org-koma-letter-use-email')
;; - place (see `org-koma-letter-use-place')
;; - location (see `org-koma-letter-use-location')
@@ -193,6 +195,13 @@ This option can also be set with the URL keyword."
:type 'string
:safe #'stringp)
+(defcustom org-koma-letter-from-logo ""
+ "Commands for inserting the sender’s logo, e. g., \\includegraphics{logo}.
+This option can also be set with the FROM_LOGO keyword."
+ :group 'org-export-koma-letter
+ :type 'string
+ :safe #'stringp)
+
(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."
@@ -379,6 +388,14 @@ This option can also be set with the OPTIONS keyword, e.g.:
:type 'boolean
:safe #'booleanp)
+(defcustom org-koma-letter-use-from-logo nil
+ "Non-nil prints sender's FROM_LOGO.
+This option can also be set with the OPTIONS keyword, e.g.:
+\"from-logo:t\"."
+ :group 'org-export-koma-letter
+ :type 'boolean
+ :safe #'booleanp)
+
(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.:
@@ -444,6 +461,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)
(:url "URL" nil org-koma-letter-url)
+ (:from-logo "FROM_LOGO" nil org-koma-letter-from-logo)
(: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)
@@ -464,6 +482,7 @@ e.g. \"title-subject:t\"."
(: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-from-logo nil "from-logo" org-koma-letter-use-from-logo)
(: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)
@@ -476,6 +495,7 @@ e.g. \"title-subject:t\"."
(:inbuffer-email "EMAIL" nil 'koma-letter:empty)
(:inbuffer-phone-number "PHONE_NUMBER" nil 'koma-letter:empty)
(:inbuffer-url "URL" nil 'koma-letter:empty)
+ (:inbuffer-from-logo "FROM_LOGO" 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)
@@ -484,6 +504,7 @@ e.g. \"title-subject:t\"."
(: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-from-logo nil "from-logo" '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)
@@ -786,6 +807,14 @@ a communication channel."
(and (funcall check-scope 'with-url)
(format "\\KOMAoption{fromurl}{%s}\n"
(if (plist-get info :with-url) "true" "false")))
+ ;; From Logo
+ (let ((from-logo (plist-get info :from-logo)))
+ (and (org-string-nw-p from-logo)
+ (funcall check-scope 'from-logo)
+ (format "\\setkomavar{fromlogo}{%s}\n" from-logo)))
+ (and (funcall check-scope 'with-from-logo)
+ (format "\\KOMAoption{fromlogo}{%s}\n"
+ (if (plist-get info :with-from-logo) "true" "false")))
;; Signature.
(let* ((heading-val
(and (plist-get info :with-headline-opening)
--
2.17.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Patch adding from-logo to ox-koma-letter.el
2018-04-28 4:30 Patch adding from-logo to ox-koma-letter.el Grant Rettke
@ 2018-04-28 4:34 ` Grant Rettke
2018-04-28 6:32 ` Bastien
2018-04-28 6:31 ` Bastien
1 sibling, 1 reply; 4+ messages in thread
From: Grant Rettke @ 2018-04-28 4:34 UTC (permalink / raw)
To: Org-mode
On Fri, Apr 27, 2018 at 11:30 PM, Grant Rettke <gcr@wisdomandwonder.com> wrote:
> Tested it manually with Elisp and also in buffer properties. There are
> four combinations (both in properties, both in Elisp, and then the two
> permutations).
Here is how it works, the same way as the other ones:
#+name: org_gcr_2018-04-27T22-46-38-05-00_mara_081C9DD8-1C37-4A55-833C-1BEC6AA754FF
#+begin_src sh
#+FROM_LOGO: \includegraphics{wnw-from-logo-1inx1in}
#+OPTIONS: from-logo:t
#+end_src
#+name: org_gcr_2018-04-27T22-46-38-05-00_mara_F28B56C1-0226-4AFB-B044-702315603A99
#+begin_src emacs-lisp
(setq org-koma-letter-from-logo "\\includegraphics{wnw-from-logo-1inx1in}")
(setq org-koma-letter-use-from-logo t)
#+end_src
If eventually this patch is accepted then I will update Worg with this variable.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch adding from-logo to ox-koma-letter.el
2018-04-28 4:30 Patch adding from-logo to ox-koma-letter.el Grant Rettke
2018-04-28 4:34 ` Grant Rettke
@ 2018-04-28 6:31 ` Bastien
1 sibling, 0 replies; 4+ messages in thread
From: Bastien @ 2018-04-28 6:31 UTC (permalink / raw)
To: Grant Rettke; +Cc: Org-mode
Hi Grant,
Grant Rettke <gcr@wisdomandwonder.com> writes:
> This patch adds from-logo support to ox-koma-letter.el.
Applied, thanks!
--
Bastien
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch adding from-logo to ox-koma-letter.el
2018-04-28 4:34 ` Grant Rettke
@ 2018-04-28 6:32 ` Bastien
0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2018-04-28 6:32 UTC (permalink / raw)
To: Grant Rettke; +Cc: Org-mode
Hi Grant,
Grant Rettke <gcr@wisdomandwonder.com> writes:
> Here is how it works, the same way as the other ones:
If needed, don't hesitate to advertize this in the comment section
of the code.
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-28 6:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-28 4:30 Patch adding from-logo to ox-koma-letter.el Grant Rettke
2018-04-28 4:34 ` Grant Rettke
2018-04-28 6:32 ` Bastien
2018-04-28 6:31 ` Bastien
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).