all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: MON KEY <monkey@sandpframing.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#5351: Rectangles of type `beer bellied'
Date: Sun, 10 Jan 2010 22:22:09 -0500	[thread overview]
Message-ID: <d2afcfda1001101922n5a84df97i40c1ee3c9406788@mail.gmail.com> (raw)

This bug report is apropos Emacs bug - #1184
of Thu, 16 Oct 2008 19:45:02 UTC
"document how to deal with beer belly rectangles"
Bug #1184 is Tagged: wontfix

As that bug report log contains one legit message and 44 bogus messages rather
than add to the fray I am starting a new bug report.

FWIW the following function handles the problem.

;;; ==============================
;;; :BUG #1184 of Thu, 16 Oct 2008 19:45:02 UTC
;;; "document how to deal with beer belly rectangles"
;;; :SEE (URL `http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1184')
;;; :CREATED <Timestamp: #{2010-01-10T21:26:28-05:00Z}#{10017} - by MON>
(defun kill-rectangle-w-beer-belly (belly-start belly-end)
"Like kill-rectangle but adds trailing whitespace when column at mark is less
than the longest line in rectangle."
  (interactive "r\n")
  (let ((max-len 0)
        (fatter-belly))
    (unwind-protect
         (narrow-to-region belly-start belly-end)
      (goto-char (point-min))
      (while (eq (forward-line) 0)
        (end-of-line)
        (when (> (current-column) max-len)
          (setq max-len (current-column))))
      (when (= (current-column) max-len)
        (setq fatter-belly t)
        (kill-rectangle belly-start belly-end))
      (unless fatter-belly
        (setq fatter-belly (buffer-substring-no-properties belly-start
belly-end))
        (goto-char belly-start)
        (kill-line)
        (while (eq (forward-line) 0) (kill-line))
        (when (stringp fatter-belly)
          (with-temp-buffer
            (insert fatter-belly)
            (goto-char (point-min))
            (while (eq (forward-line) 0)
              (let ((lebp `(,(line-beginning-position) . ,(line-end-position))))
                (unless (= (- (car lebp) (cdr lebp)) max-len)
                  (end-of-line)
                  (insert (make-string (- max-len (- (cdr lebp) (car
lebp))) 32)))))
            (kill-rectangle (buffer-end 0) (buffer-end 1)))))
      (widen))))

/s_P\







                 reply	other threads:[~2010-01-11  3:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=d2afcfda1001101922n5a84df97i40c1ee3c9406788@mail.gmail.com \
    --to=monkey@sandpframing.com \
    --cc=5351@debbugs.gnu.org \
    --cc=bug-gnu-emacs@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.