comparison lisp/subr.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 183866b06e0b
children d682c0f82a71
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
504 ;; These two names are a bit awkward, as they conflict with the normal 504 ;; These two names are a bit awkward, as they conflict with the normal
505 ;; foo-to-bar naming scheme, but CLtL2 has them, so they stay. 505 ;; foo-to-bar naming scheme, but CLtL2 has them, so they stay.
506 (define-function 'char-int 'char-to-int) 506 (define-function 'char-int 'char-to-int)
507 (define-function 'int-char 'int-to-char) 507 (define-function 'int-char 'int-to-char)
508 508
509 (defun string-width (string)
510 "Return number of columns STRING occupies when displayed.
511 With international (Mule) support, uses the charset-columns attribute of
512 the characters in STRING, which may not accurately represent the actual
513 display width when using a window system. With no international support,
514 simply returns the length of the string."
515 (if (featurep 'mule)
516 (let ((col 0)
517 (len (length string))
518 (i 0))
519 (while (< i len)
520 (setq col (+ col (charset-width (char-charset (aref string i)))))
521 (setq i (1+ i)))
522 col)
523 (length string)))
524
509 525
510 ;; alist/plist functions 526 ;; alist/plist functions
511 (defun plist-to-alist (plist) 527 (defun plist-to-alist (plist)
512 "Convert property list PLIST into the equivalent association-list form. 528 "Convert property list PLIST into the equivalent association-list form.
513 The alist is returned. This converts from 529 The alist is returned. This converts from