diff options
author | Stefan Monnier <[email protected]> | 2014-06-19 10:58:57 -0400 |
---|---|---|
committer | Stefan Monnier <[email protected]> | 2014-06-19 10:58:57 -0400 |
commit | d10a551d9d6b25de0f46c18a30b7399c993d498e (patch) | |
tree | 3b17b9c3407ccc45e00b23c95509d40c42985f94 /lisp | |
parent | 96db005527ef9d9c45c5ec8e91b01e91ee37a7fd (diff) |
* lisp/international/mule-util.el (truncate-string-ellipsis): New var.
(truncate-string-to-width): Use it.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/international/mule-util.el | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index af2eb9712a..1bc768a3b5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Stefan Monnier <[email protected]> + + * international/mule-util.el (truncate-string-ellipsis): New var. + (truncate-string-to-width): Use it. + 2014-06-19 Robert Brown <[email protected]> (tiny change) * emacs-lisp/lisp-mode.el (lisp-string-after-doc-keyword-p): New fun. diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el index efafb96538..42bc5ef1e5 100644 --- a/lisp/international/mule-util.el +++ b/lisp/international/mule-util.el @@ -56,6 +56,9 @@ (setq i (1+ i))))) string) +(defvar truncate-string-ellipsis "..." ;"…" + "String to use to indicate truncation.") + ;;;###autoload (defun truncate-string-to-width (str end-column &optional start-column padding ellipsis) @@ -80,11 +83,11 @@ If ELLIPSIS is non-nil, it should be a string which will replace the end of STR (including any padding) if it extends beyond END-COLUMN, unless the display width of STR is equal to or less than the display width of ELLIPSIS. If it is non-nil and not a string, then ELLIPSIS -defaults to \"...\"." +defaults to `truncate-string-ellipsis'." (or start-column (setq start-column 0)) (when (and ellipsis (not (stringp ellipsis))) - (setq ellipsis "...")) + (setq ellipsis truncate-string-ellipsis)) (let ((str-len (length str)) (str-width (string-width str)) (ellipsis-len (if ellipsis (length ellipsis) 0)) |