unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Roland Winkler" <winkler@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gojjoe2@googlemail.com, 39686@debbugs.gnu.org
Subject: bug#39686: 25.2; Wrong behaviour of bibtex-autokey-name-change-strings
Date: Fri, 21 Feb 2020 13:50:01 -0600	[thread overview]
Message-ID: <13417.821.396724.24144@gargle.gargle.HOWL> (raw)
In-Reply-To: <837e0gj87a.fsf@gnu.org>

On Fri Feb 21 2020 Eli Zaretskii wrote:
> I don't see a patch, just a defvar.  Which part(s) of that are
> modified, and how?
> 
> Also, what commands/features will be affected by this change?

I am sorry, I had tried to keep things readable for the OP.
A proper patch is attached below.

The patch affects the autokey machinery of bibtex-mode that
calculates keys for new BibTeX entries based on the content of an
entry.  The entry point for the autokey machinery is the function
bibtex-generate-autokey.  In bibtex.el, this function is called once
by the user command bibtex-clean-entry.  No other package inside
emacs relies on this.


diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index a7be57e..670e763 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1006,32 +1006,36 @@ bibtex-autokey-expand-strings
   :type 'boolean)
 
 (defvar bibtex-autokey-transcriptions
-  '(;; language specific characters
-    ("\\\\aa" . "a")                      ; \aa           -> a
-    ("\\\\AA" . "A")                      ; \AA           -> A
-    ("\\\"a\\|\\\\\\\"a\\|\\\\ae" . "ae") ; "a,\"a,\ae    -> ae
-    ("\\\"A\\|\\\\\\\"A\\|\\\\AE" . "Ae") ; "A,\"A,\AE    -> Ae
-    ("\\\\i" . "i")                       ; \i            -> i
-    ("\\\\j" . "j")                       ; \j            -> j
-    ("\\\\l" . "l")                       ; \l            -> l
-    ("\\\\L" . "L")                       ; \L            -> L
-    ("\\\"o\\|\\\\\\\"o\\|\\\\o\\|\\\\oe" . "oe") ; "o,\"o,\o,\oe -> oe
-    ("\\\"O\\|\\\\\\\"O\\|\\\\O\\|\\\\OE" . "Oe") ; "O,\"O,\O,\OE -> Oe
-    ("\\\"s\\|\\\\\\\"s\\|\\\\3" . "ss")  ; "s,\"s,\3     -> ss
-    ("\\\"u\\|\\\\\\\"u" . "ue")          ; "u,\"u        -> ue
-    ("\\\"U\\|\\\\\\\"U" . "Ue")          ; "U,\"U        -> Ue
-    ;; accents
-    ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "")
-    ;; braces, quotes, concatenation.
-    ("[`'\"{}#]" . "")
-    ("\\\\-" . "")                        ; \-            ->
-    ;; spaces
-    ("\\\\?[ \t\n]+\\|~" . " "))
+  (nconc
+   (mapcar (lambda (a) (cons (regexp-opt (car a)) (cdr a)))
+           '(;; language specific characters
+             (("\\aa") . "a")                      ; \aa           -> a
+             (("\\AA") . "A")                      ; \AA           -> A
+             (("\"a" "\\\"a" "\\ae") . "ae")       ; "a,\"a,\ae    -> ae
+             (("\"A" "\\\"A" "\\AE") . "Ae")       ; "A,\"A,\AE    -> Ae
+             (("\\i") . "i")                       ; \i            -> i
+             (("\\j") . "j")                       ; \j            -> j
+             (("\\l") . "l")                       ; \l            -> l
+             (("\\L") . "L")                       ; \L            -> L
+             (("\"o" "\\\"o" "\\o" "\\oe") . "oe") ; "o,\"o,\o,\oe -> oe
+             (("\"O" "\\\"O" "\\O" "\\OE") . "Oe") ; "O,\"O,\O,\OE -> Oe
+             (("\"s" "\\\"s" "\\3") . "ss")        ; "s,\"s,\3     -> ss
+             (("\"u" "\\\"u") . "ue")              ; "u,\"u        -> ue
+             (("\"U" "\\\"U") . "Ue")              ; "U,\"U        -> Ue
+             ;; hyphen, accents
+             (("\\-" "\\`" "\\'" "\\^" "\\~" "\\=" "\\." "\\u" "\\v"
+               "\\H" "\\t" "\\c" "\\d" "\\b") . "")
+             ;; space
+             (("~") . " ")))
+   ;; more spaces
+   '(("[\s\t\n]*\\(?:\\\\\\)?[\s\t\n]+" . " ")
+     ;; braces, quotes, concatenation.
+     ("[`'\"{}#]" . "")))
   "Alist of (OLD-REGEXP . NEW-STRING) pairs.
-Used by the default values of `bibtex-autokey-name-change-strings' and
+Used as default values of `bibtex-autokey-name-change-strings' and
 `bibtex-autokey-titleword-change-strings'.  Defaults to translating some
 language specific characters to their ASCII transcriptions, and
-removing any character accents.")
+removing any accent characters.")
 
 (defcustom bibtex-autokey-name-change-strings
   bibtex-autokey-transcriptions





  reply	other threads:[~2020-02-21 19:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  4:54 bug#39686: 25.2; Wrong behaviour of bibtex-autokey-name-change-strings Roland Winkler
     [not found] ` <handler.39686.B.158217451717286.ack@debbugs.gnu.org>
2020-02-20  5:04   ` Roland Winkler
2020-02-21  9:22     ` gojjoe2--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-02-21 14:06       ` Roland Winkler
2020-02-21 14:08         ` gojjoe2--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-02-21 14:13     ` Roland Winkler
2020-02-21 15:01       ` Eli Zaretskii
2020-02-21 19:50         ` Roland Winkler [this message]
2020-02-22  9:12           ` Eli Zaretskii
2020-03-06  8:46             ` Roland Winkler
2020-02-21 16:05 ` Mattias Engdegård
2020-02-21 20:03   ` Roland Winkler
2020-02-21 20:43     ` Mattias Engdegård
2020-02-21 21:03       ` Roland Winkler
2020-02-21 21:32         ` Mattias Engdegård

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=13417.821.396724.24144@gargle.gargle.HOWL \
    --to=winkler@gnu.org \
    --cc=39686@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gojjoe2@googlemail.com \
    /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.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).