emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* smart quotes and languages like en-gb
@ 2021-11-28 17:46 Rasmus
  2021-11-28 18:12 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2021-11-28 17:46 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

I have noticed that smart quotes are not picked up for “long” languages,
like “en-gb”, since smart quotes are defined for “short” languages, like
“en”, in org-export-smart-quotes-alist.

The attached patch is an attempt at remedying this.  Not sure if it is the
best fix, though...

Test file:

    #+language: en-gb
    "Foo"

Thanks,
Rasmus

-- 
Dung makes an excellent fertilizer

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-export-activate-smart-quotes-Support-languages-w.patch --]
[-- Type: text/x-patch, Size: 928 bytes --]

From 44df143a60e035816bcf5a241631e48b9b0a487a Mon Sep 17 00:00:00 2001
From: Rasmus Pank Roulund <X260@pank.eu>
Date: Sun, 28 Nov 2021 18:41:34 +0100
Subject: [PATCH] org-export-activate-smart-quotes: Support languages with
 hyphens.

Get smart-quotes from "en" for "#+language: en-gb".
---
 lisp/ox.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 98c9c1119..6f10112bb 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5688,8 +5688,9 @@ Return the new string."
      (lambda (match)
        (or (plist-get
 	    (cdr (assq (pop quote-status)
-		       (cdr (assoc (plist-get info :language)
-				   org-export-smart-quotes-alist))))
+		       (cdr (cl-assoc (plist-get info :language)
+				      org-export-smart-quotes-alist
+                                      :test (lambda (lang k) (string-match-p k lang))))))
 	    encoding)
 	   match))
      s nil t)))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-30 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-28 17:46 smart quotes and languages like en-gb Rasmus
2021-11-28 18:12 ` Nicolas Goaziou
2021-11-30 19:37   ` Rasmus

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).