all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#2385: bibtex autokey no longer ignores uncapitalized title words
@ 2009-02-19 13:47 ` era eriksson
  2009-02-20  4:30   ` bug#2385: marked as done (bibtex autokey no longer ignores uncapitalized title words) Emacs bug Tracking System
  0 siblings, 1 reply; 5+ 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] 5+ 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; 5+ 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] 5+ messages in thread

* bug#2385: bibtex autokey no longer ignores uncapitalized title words
@ 2009-02-20  1:50 Chong Yidong
  0 siblings, 0 replies; 5+ 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] 5+ 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; 5+ 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] 5+ messages in thread

* bug#2385: marked as done (bibtex autokey no longer ignores  uncapitalized title words)
  2009-02-19 13:47 ` bug#2385: bibtex autokey no longer ignores uncapitalized title words era eriksson
@ 2009-02-20  4:30   ` Emacs bug Tracking System
  0 siblings, 0 replies; 5+ messages in thread
From: Emacs bug Tracking System @ 2009-02-20  4:30 UTC (permalink / raw)
  To: Roland Winkler

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


Your message dated Fri, 20 Feb 2009 05:26:00 +0100
with message-id <18846.12504.320622.911721@tfkp07.physik.uni-erlangen.de>
and subject line Re: bug#2385: bibtex autokey no longer ignores uncapitalized title words
has caused the Emacs bug report #2385,
regarding bibtex autokey no longer ignores uncapitalized title words
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
2385: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2385
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 7130 bytes --]

From: "era eriksson" <era@iki.fi>
To: submit@emacsbugs.donarmstrong.com
Subject: bibtex autokey no longer ignores uncapitalized title words
Date: Thu, 19 Feb 2009 15:47:15 +0200
Message-ID: <1235051235.902.1301271495@webmail.messagingengine.com>



[-- Attachment #2.1.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.1.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))

[-- Attachment #3: Type: message/rfc822, Size: 1877 bytes --]

From: "Roland Winkler" <Roland.Winkler@physik.uni-erlangen.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 2385-done@emacsbugs.donarmstrong.com, era@iki.fi, Chong Yidong <cyd@stupidchicken.com>
Subject: Re: bug#2385: bibtex autokey no longer ignores uncapitalized title words
Date: Fri, 20 Feb 2009 05:26:00 +0100
Message-ID: <18846.12504.320622.911721@tfkp07.physik.uni-erlangen.de>

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

I installed the patch (including a comment in the docstring for
bibtex-autokey-titleword-ignore that case is significant.)


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <18846.12504.320622.911721@tfkp07.physik.uni-erlangen.de>
2009-02-19 13:47 ` bug#2385: bibtex autokey no longer ignores uncapitalized title words era eriksson
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.