all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: dick <dick.r.chiang@gmail.com>
Cc: 52676-done@debbugs.gnu.org
Subject: bug#52676: 28.0.50; [PATCH] Rationalize window-text-pixel-size
Date: Mon, 20 Dec 2021 00:20:55 -0500	[thread overview]
Message-ID: <87o85byhqg.fsf@dick> (raw)
In-Reply-To: <87h7b43qjb.fsf@yahoo.com> (Po Lu's message of "Mon, 20 Dec 2021 11:26:32 +0800")

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"))))))





  reply	other threads:[~2021-12-20  5:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20  2:32 bug#52676: 28.0.50; [PATCH] Rationalize window-text-pixel-size dick
2021-12-20  3:26 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-20  5:20   ` dick [this message]
2021-12-20 17:11     ` Eli Zaretskii
2021-12-21  1:36       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21  3:30         ` Eli Zaretskii
2021-12-21  3:38           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21 12:12             ` Eli Zaretskii
2021-12-21 12:19               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21 17:56                 ` dick
2021-12-21 18:05                   ` Robert Pluim
2021-12-22  0:59                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21 18:06                   ` Eli Zaretskii
2021-12-22  0:58                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21  1:34     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-20 15:19 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o85byhqg.fsf@dick \
    --to=dick.r.chiang@gmail.com \
    --cc=52676-done@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.