emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One more string functions change


From: Dmitry Antipov
Subject: Re: One more string functions change
Date: Sat, 28 Jun 2014 07:48:39 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 06/28/2014 02:46 AM, Drew Adams wrote:

Why?  Is (string-lessp s1 s2 t) really that much handier than being
explicit?

(let ((case-fold-search  t)) (string-lessp s1 s2))

or

(string-lessp (upper s1) (upper s2))

We already have a global variable for this.  Why add an argument for it?

Value of case-fold-search doesn't affect string-lessp and string-equal.

How many occurrences of such a programming cliche for `string-lessp'
do you find in the Emacs sources, for example?  One?  Zero?

Just ask grep:

lisp/textmodes/flyspell.el-1016-      (while (and (not r) (setq p 
(search-backward word bound t)))
lisp/textmodes/flyspell.el-1017-        (let ((lw (flyspell-get-word)))
lisp/textmodes/flyspell.el-1018-          (if (and (consp lw)
lisp/textmodes/flyspell.el-1019-                   (if ignore-case
lisp/textmodes/flyspell.el:1020:                       (string-equal (downcase 
(car lw)) (downcase word))
lisp/textmodes/flyspell.el:1021:                     (string-equal (car lw) 
word)))

lisp/gnus/gnus-util.el-1437-  "Like `string-equal', except it compares 
case-insensitively."
lisp/gnus/gnus-util.el-1438-  (and (= (length x) (length y))
lisp/gnus/gnus-util.el:1439:       (or (string-equal x y)
lisp/gnus/gnus-util.el:1440:       (string-equal (downcase x) (downcase y)))))

lisp/gnus/gnus-util.el-1972-       (if ignore-case
lisp/gnus/gnus-util.el:1973:           (string-equal (downcase str1) (downcase 
prefix))
lisp/gnus/gnus-util.el:1974:         (string-equal str1 prefix))))))

lisp/info.el-2882-                         ;; Use string-equal, not equal,
lisp/info.el-2883-                         ;; to ignore text properties.
lisp/info.el:2884:                         (string-equal (downcase prevnode)
lisp/info.el-2885-                                       (downcase upnode))))

lisp/recentf.el-312-  (if recentf-case-fold-search
lisp/recentf.el:313:      (string-equal (downcase s1) (downcase s2))
lisp/recentf.el:314:    (string-equal s1 s2)))

lisp/emacs-lisp/cl-extra.el:72:       (or (string-equal x y)
lisp/emacs-lisp/cl-extra.el:73:           (string-equal (downcase x) (downcase 
y))))) ;Lazy but simple!

lisp/ibuf-ext.el:1128:  (string-lessp (downcase
lisp/ibuf-ext.el-1129-           (symbol-name (buffer-local-value 'major-mode 
(car a))))
lisp/ibuf-ext.el-1130-          (downcase
lisp/ibuf-ext.el-1131-           (symbol-name (buffer-local-value 'major-mode 
(car b))))))

lisp/ibuf-ext.el:1138:  (string-lessp (downcase
lisp/ibuf-ext.el-1139-           (with-current-buffer
lisp/ibuf-ext.el-1140-               (car a)
lisp/ibuf-ext.el-1141-             (format-mode-line mode-name)))
lisp/ibuf-ext.el-1142-          (downcase
lisp/ibuf-ext.el-1143-           (with-current-buffer

etc.

Dmitry




reply via email to

[Prev in Thread] Current Thread [Next in Thread]