Function: compilation--insert-abbreviated-line

compilation--insert-abbreviated-line is a byte-compiled function defined in compile.el.gz.

Signature

(compilation--insert-abbreviated-line STRING WIDTH)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defun compilation--insert-abbreviated-line (string width)
  (if (and (> (current-column) 0)
           (get-text-property (1- (point)) 'button))
      ;; We already have an abbreviation; just add the string to it.
      (let ((beg (point)))
        (insert string)
        (add-text-properties
         beg
         ;; Don't make the final newline invisible.
         (if (= (aref string (1- (length string))) ?\n)
             (1- (point))
           (point))
         (text-properties-at (1- beg))))
    (insert string)
    ;; If we exceeded the limit, hide the last portion of the line.
    (let* ((ends-in-nl (= (aref string (1- (length string))) ?\n))
           (curcol (if ends-in-nl
                       (progn (backward-char) (current-column))
                     (current-column))))
      (when (> curcol width)
        (let ((start (save-excursion
                       (move-to-column width)
                       (point))))
          (buttonize-region
           start (point)
           (lambda (start)
             (let ((inhibit-read-only t))
               (remove-text-properties start (save-excursion
                                               (goto-char start)
                                               (line-end-position))
                                       (text-properties-at start)))))
          (put-text-property
           start (point)
           'display (if (char-displayable-p ?…) "[…]" "[...]"))))
      (if ends-in-nl (forward-char)))))