unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2385: bibtex autokey no longer ignores uncapitalized title words
@ 2009-02-19 13:47 era eriksson
  0 siblings, 0 replies; 4+ messages in thread
From: era eriksson @ 2009-02-19 13:47 UTC (permalink / raw)
  To: submit

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

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

* bug#2385: bibtex autokey no longer ignores uncapitalized title words
@ 2009-02-20  0:19 Roland Winkler
  2009-02-20  3:12 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Winkler @ 2009-02-20  0:19 UTC (permalink / raw)
  To: era; +Cc: 2385

In general, the patch makes sense to me and I am willing to install
it.  Can someone else comment on the following part?

+	;;;;;;;; XXX FIXME: case-fold-search should be unnecessary here
+	;; [[:upper:]] and [[:lower:]] should be unaffected by case folding
+        (unless (let ((case-fold-search nil))

Thanks,

Roland






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

* bug#2385: bibtex autokey no longer ignores uncapitalized title words
@ 2009-02-20  1:50 Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2009-02-20  1:50 UTC (permalink / raw)
  To: Roland Winkler; +Cc: era, 2385

> In general, the patch makes sense to me and I am willing to install
> it.  Can someone else comment on the following part?
>
> +    ;;;;;;;; XXX FIXME: case-fold-search should be unnecessary here
> +    ;; [[:upper:]] and [[:lower:]] should be unaffected by case folding
> +        (unless (let ((case-fold-search nil))

I doubt we're going to change this behavior in the near future.






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

* bug#2385: bibtex autokey no longer ignores uncapitalized title words
  2009-02-20  0:19 bug#2385: bibtex autokey no longer ignores uncapitalized title words Roland Winkler
@ 2009-02-20  3:12 ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2009-02-20  3:12 UTC (permalink / raw)
  To: Roland Winkler; +Cc: era, 2385

> Can someone else comment on the following part?

> +	;;;;;;;; XXX FIXME: case-fold-search should be unnecessary here
> +	;; [[:upper:]] and [[:lower:]] should be unaffected by case folding
> +        (unless (let ((case-fold-search nil))

Whether [:upper:] and [:lower:] should be affected by case folding or
not is a good question.  I'm personally not sure which option is best.
But in any case in Emacs they *are* affected so the case-fold-search
binding does make a difference.

> In general, the patch makes sense to me and I am willing to install it.

Please install it then and close the bug, thank you.


        Stefan








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

end of thread, other threads:[~2009-02-20  3:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-02-19 13:47 era eriksson

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