Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!usc!ucsd!ucbvax!IFI.UIO.NO!hallvard From: hallvard@IFI.UIO.NO (Hallvard B Furuseth) Newsgroups: comp.emacs Subject: Re: little kill-region hack Message-ID: <9008302122.AAgrim01966@grim.ifi.uio.no> Date: 30 Aug 90 21:22:14 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 38 Good idea, but skip the interactive test. When you use kill-word, kill-word is called interactively but kill-region is not. A kill-region-hook seems to be a good idea. Then people can display a message, or add querys, or whatever. Put (or noninteractive ...) in the hook; we don't want any bells and whistles in batch mode. Load this and try (setq kill-region-hook 'kill-region-warning). (defun kill-region (beg end) "Kill between point and mark. The text is deleted but saved in the kill ring. The command \\[yank] can retrieve it from there. \(If you want to kill and then yank immediately, use \\[copy-region-as-kill].) This is the primitive for programs to kill text (as opposed to deleting it). Supply two arguments, character numbers indicating the stretch of text to be killed. Any command that calls this function is a \"kill command\". If the previous command was also a kill command, the text killed this time appends to the text killed last time to make one entry in the kill ring. Calls kill-region-hook first, with variables beg and end specifying the region." (interactive "*r") (run-hooks 'kill-region-hook) (copy-region-as-kill beg end) (delete-region beg end)) (defun kill-region-warning () "Used in kill-region-hook to display no of chars to be killed." (or noninteractive ; Silent in batch mode (message "Killing %d chars" (- end beg)))) Hallvard Furuseth hallvard@ifi.uio.no