emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: smart quotes and languages like en-gb
Date: Sun, 28 Nov 2021 18:46:35 +0100	[thread overview]
Message-ID: <87ilwcuq9w.fsf@gmx.us> (raw)

[-- 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


             reply	other threads:[~2021-11-28 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 17:46 Rasmus [this message]
2021-11-28 18:12 ` smart quotes and languages like en-gb Nicolas Goaziou
2021-11-30 19:37   ` Rasmus

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=87ilwcuq9w.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --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 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).