all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: kai.grossjohann@gmx.net
Subject: Re: Various simple.el patches
Date: Thu, 22 May 2003 22:52:45 -0500 (CDT)	[thread overview]
Message-ID: <200305230352.h4N3qj211239@eel.dms.auburn.edu> (raw)
In-Reply-To: <200305220252.h4M2q9W10068@eel.dms.auburn.edu> (message from Luc Teirlinck on Wed, 21 May 2003 21:52:09 -0500 (CDT))

The following version of kill-whole-line should work OK with the
kill-ring, including read-only buffers, and with invisible text.
It implements the version I referred to previously as "version2", but
other types of behavior could be implemented in a similar way, should
they be deemed more desirable.

Invisible text will work OK if you apply the patch to simple.el which
I sent yesterday and avoid using lists with two or more elements as
invisibility properties.  If you do the latter, the invisibility
related machinery of simple.el will malfunction.  This is a problem
unrelated to kill-whole-line, which can easily be solved by using a
corrected version of line-move-invisible, either the one I sent today,
or one from the C code, as Stefan suggested.

===File ~/newkwlversion2.el=================================
(defun kill-whole-line (&optional arg)
  "Kill current line.
With prefix arg, kill that many lines from point.
If arg is negative, kill backwards.
If arg is zero, kill current line but exclude the trailing newline."
  (interactive "P")
  (setq arg (prefix-numeric-value arg))
  (if (and (> arg 0) (eobp) (save-excursion (forward-visible-line 0) (eobp)))
      (signal 'end-of-buffer nil))
  (if (and (< arg 0) (bobp) (save-excursion (end-of-visible-line) (bobp)))
      (signal 'beginning-of-buffer nil))
  (unless (eq last-command 'kill-region)
    (kill-new "")
    (setq last-command 'kill-region))
  (cond ((zerop arg)
	 (save-excursion
	   (kill-region (point) (progn (forward-visible-line 0) (point))))
	 (kill-region (point) (progn (end-of-visible-line) (point))))
	((< arg 0)
	 (save-excursion
	   (kill-region (point) (progn (end-of-visible-line) (point))))
	 (kill-region (point)
		      (progn (forward-visible-line (1+ arg))
			     (unless (bobp) (backward-char))
			     (point))))
	(t
	 (save-excursion
	   (kill-region (point) (progn (forward-visible-line 0) (point))))
	 (kill-region (point)
		      (progn (forward-visible-line arg) (point))))))

============================================================

  reply	other threads:[~2003-05-23  3:52 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-13 20:31 Various simple.el patches Stefan Monnier
2003-05-14 11:44 ` Kai Großjohann
2003-05-14 12:42   ` Miles Bader
2003-05-14 13:58     ` Kai Großjohann
2003-05-14 14:48       ` Miles Bader
2003-05-14 15:54         ` Kai Großjohann
2003-05-16  3:51           ` Richard Stallman
2003-05-16  5:54             ` Kai Großjohann
2003-05-17 13:49               ` Richard Stallman
2003-05-18 15:38                 ` Kai Großjohann
2003-05-19  2:11                   ` Luc Teirlinck
2003-05-19  7:42                     ` Kai Großjohann
2003-05-19 14:22                       ` Luc Teirlinck
2003-05-21  3:12                       ` Luc Teirlinck
2003-05-21 14:07                         ` Luc Teirlinck
2003-05-21 18:06                           ` Tak Ota
2003-05-21 18:16                             ` Luc Teirlinck
2003-05-21 18:33                             ` Luc Teirlinck
2003-05-21 18:44                             ` Luc Teirlinck
2003-05-22  2:52                           ` Luc Teirlinck
2003-05-23  3:52                             ` Luc Teirlinck [this message]
2003-05-23  6:57                               ` Kai Großjohann
2003-05-23 18:27                                 ` Luc Teirlinck
2003-05-23 19:04                                   ` Kai Großjohann
2003-05-23 19:45                                     ` Luc Teirlinck
2003-05-28  4:32                                     ` Luc Teirlinck
2003-05-28 18:46                                       ` Kai Großjohann
2003-05-28 19:47                                         ` Luc Teirlinck
2003-05-28 20:11                                           ` Kai Großjohann
2003-05-30  0:50                                         ` Richard Stallman
2003-05-24 10:00                                   ` Eli Zaretskii
2003-05-25  2:42                                     ` Luc Teirlinck
2003-05-25  3:33                                       ` Eli Zaretskii
2003-05-25  4:43                                         ` Luc Teirlinck
2003-05-25  5:00                                           ` Luc Teirlinck
2003-05-26 13:48                                             ` Richard Stallman
2003-05-25 17:08                                           ` Eli Zaretskii
2003-05-25 15:06                                         ` Stefan Monnier
2003-05-25 15:04                                       ` Stefan Monnier
2003-05-23 18:47                                 ` Luc Teirlinck
2003-05-23 13:51                               ` Stefan Monnier
2003-05-23 17:06                                 ` Luc Teirlinck
2003-05-23 19:07                                   ` Kai Großjohann
2003-05-23 19:24                               ` Kai Großjohann
2003-05-23 19:39                                 ` Luc Teirlinck
2003-05-24 23:20                                 ` Richard Stallman
2003-05-27 17:43                                   ` Kevin Rodgers
2003-05-28 23:58                                     ` Richard Stallman
2003-05-14 16:38         ` Ami Fischman
2003-05-14 17:38           ` Stefan Monnier
2003-05-16  3:51         ` Richard Stallman
2003-05-15 15:40 ` Jan Nieuwenhuizen
2003-05-15 15:45   ` Stefan Monnier
2003-05-16 15:47 ` Richard Stallman
2003-05-16 18:18   ` Stefan Monnier
2003-05-18 12:22     ` Richard Stallman
2003-05-18 15:13       ` Kai Großjohann
2003-05-19 14:53         ` Richard Stallman

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=200305230352.h4N3qj211239@eel.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=kai.grossjohann@gmx.net \
    /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.