GNU bug report logs - #52676
28.0.50; [PATCH] Rationalize window-text-pixel-size

Previous Next

Package: emacs;

Reported by: dick <dick.r.chiang <at> gmail.com>

Date: Mon, 20 Dec 2021 02:33:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 52676-done <at> debbugs.gnu.org (full text, mbox):

From: dick <dick.r.chiang <at> gmail.com>
Cc: 52676-done <at> debbugs.gnu.org
Subject: Re: bug#52676: 28.0.50; [PATCH] Rationalize window-text-pixel-size
Date: Mon, 20 Dec 2021 00:20:55 -0500
I am sure there was a way to do what you wanted without resorting to
what you did.  Perhaps I've been too harsh on you.  You've gotten a lot
of poor (but earnest) counsel from emacs-devel.

What sucks is the statute of limitations on function signature changes
is short.  Once released, that jank, incomprehensibly specific parameter
"ignore-line-at-end" is here to stay.

(defmacro xdisp-tests--visible-buffer (&rest body)
  (declare (debug t) (indent 0))
  `(progn
     (switch-to-buffer "his-fooness")
     (unwind-protect
         (progn ,@body)
       (let (kill-buffer-query-functions)
         (kill-buffer "his-fooness")))))

(xdisp-tests--visible-buffer
  (cl-flet ((test-it
              (what from to)
              (erase-buffer)
              (save-excursion
                (insert what))
              (let ((dims (window-text-pixel-size nil from to nil nil nil t))
                    (dims* (window-text-pixel-size nil from to)))
                (cl-assert
                 dims
                 (cons (car dims*)
                       (- (cdr dims*)
                          (save-excursion
                            (goto-char to)
                            (if (> (line-end-position) (line-beginning-position))
                                (line-pixel-height)
                              0))))))))
    (let ((text "foo\nbar"))
      (test-it text 1 (1+ (length text))))
    (let ((text "foo\nbar\n"))
      (test-it text 1 (1+ (length text))))
    (let ((text "foo\nbar\nbaz"))
      (test-it text 1 (1+ (length text))))
    (let ((text "foo\nbar\n"))
      (test-it text 1 (1+ (length "foo\nbar"))))))




This bug report was last modified 3 years and 149 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.