- (if (> (length formatted-authors)
- (length formatted-sample))
- (let ((visible-length (- (length formatted-sample)
- (length "... "))))
- ;; Truncate the visible string according to the width of
- ;; the display string.
- (setq visible-string (substring formatted-authors 0 visible-length)
- invisible-string (substring formatted-authors visible-length))
- ;; If possible, truncate the visible string at a natural
- ;; break (comma or pipe), as incremental search doesn't
- ;; match across the visible/invisible border.
- (when (string-match "\\(.*\\)\\([,|] \\)\\([^,|]*\\)" visible-string)
- ;; Second clause is destructive on `visible-string', so
- ;; order is important.
- (setq invisible-string (concat (match-string 3 visible-string)
- invisible-string)
- visible-string (concat (match-string 1 visible-string)
- (match-string 2 visible-string))))
- ;; `visible-string' may be shorter than the space allowed
- ;; by `format-string'. If so we must insert some padding
- ;; after `invisible-string'.
- (setq padding (make-string (- (length formatted-sample)
- (length visible-string)
- (length "..."))
- ? ))))
-
+ (when (> (length formatted-authors)
+ (length formatted-sample))
+ (let ((visible-length (- (length formatted-sample)
+ (length "... "))))
+ ;; Truncate the visible string according to the width of
+ ;; the display string.
+ (setq visible-string (substring formatted-authors 0 visible-length))
+ (setq invisible-string (substring formatted-authors visible-length))
+ ;; If possible, truncate the visible string at a natural
+ ;; break (comma or pipe), as incremental search doesn't
+ ;; match across the visible/invisible border.
+ (when (string-match "\\(.*\\)\\([,|] \\)\\([^,|]*\\)" visible-string)
+ ;; Second clause is destructive on `visible-string', so
+ ;; order is important.
+ (setq invisible-string (concat (match-string 3 visible-string)
+ invisible-string))
+ (setq visible-string (concat (match-string 1 visible-string)
+ (match-string 2 visible-string))))
+ ;; `visible-string' may be shorter than the space allowed
+ ;; by `format-string'. If so we must insert some padding
+ ;; after `invisible-string'.
+ (setq padding (make-string (- (length formatted-sample)
+ (length visible-string)
+ (length "..."))
+ ? ))))