diff options
| author | Juanma Barranquero | 2008-11-20 23:07:44 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2008-11-20 23:07:44 +0000 |
| commit | 11eac3eaed3c433a5948133a9b990eb4f71e07c9 (patch) | |
| tree | 7713b78d4b87e2bcccb4fb7cb9b79bd26906854e | |
| parent | d46b521475d73f3452e0a5cfdf0533233159adcd (diff) | |
| download | emacs-11eac3eaed3c433a5948133a9b990eb4f71e07c9.tar.gz emacs-11eac3eaed3c433a5948133a9b990eb4f71e07c9.zip | |
* international/mule-util.el (set-nested-alist): Doc fix. Use `when'.
(lookup-nested-alist): Doc fix.
(with-coding-priority): Reflow docstring.
(detect-coding-with-priority): Fix typos in obsolescence declaration.
(char-displayable-p): Reflow docstring. Use `when'.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/international/mule-util.el | 87 |
2 files changed, 52 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e86f7512083..271832a951a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2008-11-20 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * international/mule-util.el (set-nested-alist): Doc fix. Use `when'. | ||
| 4 | (lookup-nested-alist): Doc fix. | ||
| 5 | (with-coding-priority): Reflow docstring. | ||
| 6 | (detect-coding-with-priority): Fix typos in obsolescence declaration. | ||
| 7 | (char-displayable-p): Reflow docstring. Use `when'. | ||
| 8 | |||
| 1 | 2008-11-20 Dan Nicolaescu <dann@ics.uci.edu> | 9 | 2008-11-20 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 10 | ||
| 3 | * calendar/cal-menu.el (cal-menu-scroll-menu): Add bindings for | 11 | * calendar/cal-menu.el (cal-menu-scroll-menu): Add bindings for |
| @@ -14,7 +22,7 @@ | |||
| 14 | (Buffer-menu-buffer+size): Use it, fix last change, and simplify. | 22 | (Buffer-menu-buffer+size): Use it, fix last change, and simplify. |
| 15 | (list-buffers-noselect): Don't need to pad. | 23 | (list-buffers-noselect): Don't need to pad. |
| 16 | 24 | ||
| 17 | 2008-11-20 Toru TSUNEYOSHI <t_tuneyosi@hotmail.com> | 25 | 2008-11-20 Toru TSUNEYOSHI <t_tuneyosi@hotmail.com> |
| 18 | 26 | ||
| 19 | * buff-menu.el (Buffer-menu-buffer+size, list-buffers-noselect): | 27 | * buff-menu.el (Buffer-menu-buffer+size, list-buffers-noselect): |
| 20 | Pay attention to char widths when computing string sizes. | 28 | Pay attention to char widths when computing string sizes. |
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el index 165827ee255..de4aafed363 100644 --- a/lisp/international/mule-util.el +++ b/lisp/international/mule-util.el | |||
| @@ -233,8 +233,8 @@ can be a string, a vector, or a list." | |||
| 233 | (defun set-nested-alist (keyseq entry alist &optional len branches) | 233 | (defun set-nested-alist (keyseq entry alist &optional len branches) |
| 234 | "Set ENTRY for KEYSEQ in a nested alist ALIST. | 234 | "Set ENTRY for KEYSEQ in a nested alist ALIST. |
| 235 | Optional 4th arg LEN non-nil means the first LEN elements in KEYSEQ | 235 | Optional 4th arg LEN non-nil means the first LEN elements in KEYSEQ |
| 236 | is considered. | 236 | are considered. |
| 237 | Optional argument BRANCHES if non-nil is branches for a keyseq | 237 | Optional 5th argument BRANCHES if non-nil is branches for a keyseq |
| 238 | longer than KEYSEQ. | 238 | longer than KEYSEQ. |
| 239 | See the documentation of `nested-alist-p' for more detail." | 239 | See the documentation of `nested-alist-p' for more detail." |
| 240 | (or (nested-alist-p alist) | 240 | (or (nested-alist-p alist) |
| @@ -248,10 +248,9 @@ See the documentation of `nested-alist-p' for more detail." | |||
| 248 | (error "Keyseq %s is too long for this nested alist" keyseq)) | 248 | (error "Keyseq %s is too long for this nested alist" keyseq)) |
| 249 | (setq key-elt (if islist (nth i keyseq) (aref keyseq i))) | 249 | (setq key-elt (if islist (nth i keyseq) (aref keyseq i))) |
| 250 | (setq slot (assoc key-elt (cdr alist))) | 250 | (setq slot (assoc key-elt (cdr alist))) |
| 251 | (if (null slot) | 251 | (unless slot |
| 252 | (progn | 252 | (setq slot (cons key-elt (list t))) |
| 253 | (setq slot (cons key-elt (list t))) | 253 | (setcdr alist (cons slot (cdr alist)))) |
| 254 | (setcdr alist (cons slot (cdr alist))))) | ||
| 255 | (setq alist (cdr slot)) | 254 | (setq alist (cdr slot)) |
| 256 | (setq i (1+ i))) | 255 | (setq i (1+ i))) |
| 257 | (setcar alist entry) | 256 | (setcar alist entry) |
| @@ -261,14 +260,14 @@ See the documentation of `nested-alist-p' for more detail." | |||
| 261 | ;;;###autoload | 260 | ;;;###autoload |
| 262 | (defun lookup-nested-alist (keyseq alist &optional len start nil-for-too-long) | 261 | (defun lookup-nested-alist (keyseq alist &optional len start nil-for-too-long) |
| 263 | "Look up key sequence KEYSEQ in nested alist ALIST. Return the definition. | 262 | "Look up key sequence KEYSEQ in nested alist ALIST. Return the definition. |
| 264 | Optional 1st argument LEN specifies the length of KEYSEQ. | 263 | Optional 3rd argument LEN specifies the length of KEYSEQ. |
| 265 | Optional 2nd argument START specifies index of the starting key. | 264 | Optional 4th argument START specifies index of the starting key. |
| 266 | The returned value is normally a nested alist of which | 265 | The returned value is normally a nested alist of which |
| 267 | car part is the entry for KEYSEQ. | 266 | car part is the entry for KEYSEQ. |
| 268 | If ALIST is not deep enough for KEYSEQ, return number which is | 267 | If ALIST is not deep enough for KEYSEQ, return number which is |
| 269 | how many key elements at the front of KEYSEQ it takes | 268 | how many key elements at the front of KEYSEQ it takes |
| 270 | to reach a leaf in ALIST. | 269 | to reach a leaf in ALIST. |
| 271 | Optional 3rd argument NIL-FOR-TOO-LONG non-nil means return nil | 270 | Optional 5th argument NIL-FOR-TOO-LONG non-nil means return nil |
| 272 | even if ALIST is not deep enough." | 271 | even if ALIST is not deep enough." |
| 273 | (or (nested-alist-p alist) | 272 | (or (nested-alist-p alist) |
| 274 | (error "Invalid argument %s" alist)) | 273 | (error "Invalid argument %s" alist)) |
| @@ -315,9 +314,9 @@ Optional 3rd argument NIL-FOR-TOO-LONG non-nil means return nil | |||
| 315 | ;;;###autoload | 314 | ;;;###autoload |
| 316 | (defmacro with-coding-priority (coding-systems &rest body) | 315 | (defmacro with-coding-priority (coding-systems &rest body) |
| 317 | "Execute BODY like `progn' with CODING-SYSTEMS at the front of priority list. | 316 | "Execute BODY like `progn' with CODING-SYSTEMS at the front of priority list. |
| 318 | CODING-SYSTEMS is a list of coding systems. See | 317 | CODING-SYSTEMS is a list of coding systems. See `set-coding-priority'. |
| 319 | `set-coding-priority'. This affects the implicit sorting of lists of | 318 | This affects the implicit sorting of lists of coding sysems returned by |
| 320 | coding sysems returned by operations such as `find-coding-systems-region'." | 319 | operations such as `find-coding-systems-region'." |
| 321 | (let ((current (make-symbol "current"))) | 320 | (let ((current (make-symbol "current"))) |
| 322 | `(let ((,current (coding-system-priority-list))) | 321 | `(let ((,current (coding-system-priority-list))) |
| 323 | (apply #'set-coding-system-priority ,coding-systems) | 322 | (apply #'set-coding-system-priority ,coding-systems) |
| @@ -335,7 +334,7 @@ coding systems ordered by priority." | |||
| 335 | `(with-coding-priority (mapcar #'cdr ,priority-list) | 334 | `(with-coding-priority (mapcar #'cdr ,priority-list) |
| 336 | (detect-coding-region ,from ,to))) | 335 | (detect-coding-region ,from ,to))) |
| 337 | (make-obsolete 'detect-coding-with-priority | 336 | (make-obsolete 'detect-coding-with-priority |
| 338 | "Use with-coding-priority and detect-coding-region" "23.1") | 337 | "use `with-coding-priority' and `detect-coding-region'." "23.1") |
| 339 | 338 | ||
| 340 | ;;;###autoload | 339 | ;;;###autoload |
| 341 | (defun detect-coding-with-language-environment (from to lang-env) | 340 | (defun detect-coding-with-language-environment (from to lang-env) |
| @@ -353,9 +352,9 @@ language environment LANG-ENV." | |||
| 353 | (defun char-displayable-p (char) | 352 | (defun char-displayable-p (char) |
| 354 | "Return non-nil if we should be able to display CHAR. | 353 | "Return non-nil if we should be able to display CHAR. |
| 355 | On a multi-font display, the test is only whether there is an | 354 | On a multi-font display, the test is only whether there is an |
| 356 | appropriate font from the selected frame's fontset to display CHAR's | 355 | appropriate font from the selected frame's fontset to display |
| 357 | charset in general. Since fonts may be specified on a per-character | 356 | CHAR's charset in general. Since fonts may be specified on a |
| 358 | basis, this may not be accurate." | 357 | per-character basis, this may not be accurate." |
| 359 | (cond ((< char 128) | 358 | (cond ((< char 128) |
| 360 | ;; ASCII characters are always displayable. | 359 | ;; ASCII characters are always displayable. |
| 361 | t) | 360 | t) |
| @@ -371,34 +370,34 @@ basis, this may not be accurate." | |||
| 371 | ;; On a terminal, a character is displayable if the coding | 370 | ;; On a terminal, a character is displayable if the coding |
| 372 | ;; system for the terminal can encode it. | 371 | ;; system for the terminal can encode it. |
| 373 | (let ((coding (terminal-coding-system))) | 372 | (let ((coding (terminal-coding-system))) |
| 374 | (if coding | 373 | (when coding |
| 375 | (let ((cs-list (coding-system-get coding :charset-list))) | 374 | (let ((cs-list (coding-system-get coding :charset-list))) |
| 376 | (cond | 375 | (cond |
| 377 | ((listp cs-list) | 376 | ((listp cs-list) |
| 378 | (catch 'tag | 377 | (catch 'tag |
| 379 | (mapc #'(lambda (charset) | 378 | (mapc #'(lambda (charset) |
| 380 | (if (encode-char char charset) | 379 | (if (encode-char char charset) |
| 381 | (throw 'tag charset))) | 380 | (throw 'tag charset))) |
| 382 | cs-list) | 381 | cs-list) |
| 383 | nil)) | 382 | nil)) |
| 384 | ((eq cs-list 'iso-2022) | 383 | ((eq cs-list 'iso-2022) |
| 385 | (catch 'tag2 | 384 | (catch 'tag2 |
| 386 | (mapc #'(lambda (charset) | 385 | (mapc #'(lambda (charset) |
| 387 | (if (and (plist-get (charset-plist charset) | 386 | (if (and (plist-get (charset-plist charset) |
| 388 | :iso-final-char) | 387 | :iso-final-char) |
| 389 | (encode-char char charset)) | 388 | (encode-char char charset)) |
| 390 | (throw 'tag2 charset))) | 389 | (throw 'tag2 charset))) |
| 391 | charset-list) | 390 | charset-list) |
| 392 | nil)) | 391 | nil)) |
| 393 | ((eq cs-list 'emacs-mule) | 392 | ((eq cs-list 'emacs-mule) |
| 394 | (catch 'tag3 | 393 | (catch 'tag3 |
| 395 | (mapc #'(lambda (charset) | 394 | (mapc #'(lambda (charset) |
| 396 | (if (and (plist-get (charset-plist charset) | 395 | (if (and (plist-get (charset-plist charset) |
| 397 | :emacs-mule-id) | 396 | :emacs-mule-id) |
| 398 | (encode-char char charset)) | 397 | (encode-char char charset)) |
| 399 | (throw 'tag3 charset))) | 398 | (throw 'tag3 charset))) |
| 400 | charset-list) | 399 | charset-list) |
| 401 | nil))))))))) | 400 | nil))))))))) |
| 402 | 401 | ||
| 403 | (provide 'mule-util) | 402 | (provide 'mule-util) |
| 404 | 403 | ||