unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "era eriksson" <era@iki.fi>
To: submit@emacsbugs.donarmstrong.com
Subject: bug#2385: bibtex autokey no longer ignores uncapitalized title words
Date: Thu, 19 Feb 2009 15:47:15 +0200	[thread overview]
Message-ID: <1235051235.902.1301271495@webmail.messagingengine.com> (raw)

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

Package: emacs
Version: 23.0.90.1

I'm taking the liberty to forward the following bug from the Ubuntu
Launchpad:

https://bugs.launchpad.net/ubuntu/+source/emacs22/+bug/243156

> What I Expected to Happen
> ====================
> 
> This affects the BibTeX mode. Emacs 20 changed the behaviour, thus:
> 
> *** Autokey generation now uses all words from the title, not just
> capitalized words. To avoid conflicts with existing customizations,
> bibtex-autokey-titleword-ignore is set up such that words starting 
> with lowerkey characters will still be ignored. Thus, if you want to 
> use lowercase words from the title, you will have to overwrite the 
> bibtex-autokey-titleword-ignore standard setting.
> 
> So for an entry
> 
> @InProceedings{,
>   author = {Ganter, Bernhard and Kuznetsov, Sergei O.},
>   title = {Stepwise Construction of the {Dedekind-MacNeille}
>                    Completion},
>   year = 1998,
>   booktitle = {ICCS '98: Proceedings of the 6th International 
>               Conference on Conceptual Structures},
>   pages = {295--302},
>   address = {Montpellier, France},
>   publisher = {Springer-Verlag},
>   isbn = {3-540-64791-0}
> }
> 
> pressing C-c C-c should generate and add the key
> 
>     ganter98:_stepw_const_dedek_macneil_compl
> 
> instead it generates
> 
>   ganter98:_stepw_const_of_dedek_macneil_compl
> 
> In emacs21
> =========
> 
> The variable `bibtex-autokey-titleword-ignore` is set to
> 
>   '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das"
>     "[^A-Z].*" ".*[^a-zA-Z0-9].*")
> 
> and it works as expected.
> 
> In emacs22
> =========
> 
> The variable `bibtex-autokey-titleword-ignore` is set to
> 
>   '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das"
>     "[^[:upper:]].*" ".*[^[:upper:]0-9].*")
> 
> and it does not work as expected.
> 
> Workaround
> =========
> 
> The old value from emacs21 does not solve the problem, instead I have > to enumerate all prepositions and conjunctions.

I have verified this bug with Emacs snapshot 1:20090207-1~intrepid1 from
https://launchpad.net/~ubuntu-elisp/+archive/ppa

Attached below please find a patch for Emacs 23.

/* era */

-- 
If this were a real .signature, it would suck less.  Well, maybe not.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bibtex-snapshot-el.patch --]
[-- Type: text/x-patch; name="bibtex-snapshot-el.patch", Size: 1962 bytes --]

--- emacs-snapshot-20090207/lisp/textmodes/bibtex.el~	2009-01-17 16:58:53.000000000 +0200
+++ emacs-snapshot-20090207/lisp/textmodes/bibtex.el	2009-02-19 15:33:43.000000000 +0200
@@ -746,7 +746,7 @@
 
 (defcustom bibtex-autokey-titleword-ignore
   '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das"
-    "[^[:upper:]].*" ".*[^[:upper:]0-9].*")
+    "[^[:upper:]].*" ".*[^[:upper:][:lower:]0-9].*")
   "Determines words from the title that are not to be used in the key.
 Each item of the list is a regexp.  If a word of the title matches a
 regexp from that list, it is not included in the title part of the key.
@@ -2307,6 +2307,10 @@
     ;; gather words from titlestring into a list.  Ignore
     ;; specific words and use only a specific amount of words.
     (let ((counter 0)
+	  (re (concat "\\`\\(?:"
+		      (mapconcat #'identity
+				 bibtex-autokey-titleword-ignore "\\|")
+		      "\\)\\'") )
           titlewords titlewords-extra word)
       (while (and (or (not (numberp bibtex-autokey-titlewords))
                       (< counter (+ bibtex-autokey-titlewords
@@ -2316,12 +2320,10 @@
               titlestring (substring titlestring (match-end 0)))
         ;; Ignore words matched by one of the elements of
         ;; `bibtex-autokey-titleword-ignore'
-        (unless (let ((lst bibtex-autokey-titleword-ignore))
-                  (while (and lst
-                              (not (string-match (concat "\\`\\(?:" (car lst)
-                                                         "\\)\\'") word)))
-                    (setq lst (cdr lst)))
-                  lst)
+	;;;;;;;; XXX FIXME: case-fold-search should be unnecessary here
+	;; [[:upper:]] and [[:lower:]] should be unaffected by case folding
+        (unless (let ((case-fold-search nil))
+		  (string-match re word) )
           (setq counter (1+ counter))
           (if (or (not (numberp bibtex-autokey-titlewords))
                   (<= counter bibtex-autokey-titlewords))

             reply	other threads:[~2009-02-19 13:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <18846.12504.320622.911721@tfkp07.physik.uni-erlangen.de>
2009-02-19 13:47 ` era eriksson [this message]
2009-02-20  4:30   ` bug#2385: marked as done (bibtex autokey no longer ignores uncapitalized title words) Emacs bug Tracking System
2009-02-20  0:19 bug#2385: bibtex autokey no longer ignores uncapitalized title words Roland Winkler
2009-02-20  3:12 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2009-02-20  1:50 Chong Yidong

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=1235051235.902.1301271495@webmail.messagingengine.com \
    --to=era@iki.fi \
    --cc=2385@emacsbugs.donarmstrong.com \
    --cc=submit@emacsbugs.donarmstrong.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).