[comp.emacs] GNU Emacs x-mouse.el - bug

jackr@dblues.wpd.sgi.com (John "Jack" Repenning) (03/28/91)

In my x-mouse.el, which I'm pretty sure is virgin 18.56, there's a
function x-cut-buffer defined with an &optional argument named "kill".
It's optional, all right: it's never even used!

Am I missing something here?  For example, is it really used by some
called routine I can't find?  Or in some other way my grammar-school
LISP doesn't disclose?

As nearly as I can tell, no part of x-mouse.el ever provides this
argument to x-cut-text, which at the very least makes this a bug
without symptoms.  But as it happens I found a use for the thing, and
then discovered I had to implement it!

If no one can show me the error of my ways, I'd say the definition
should actually be something along the lines of the attached (all I've
added is the clause "(and kill ...)").  Any nay-sayers?




Jack Repenning			9U-530	     jackr@wpd.sgi.com
Silicon Graphics, Inc.		            Off:(415) 335-7477
Systems Software Technology Center	    Fax:(415) 969-2314
----------------
(defun x-cut-text (arg &optional kill)
  "Copy text between point and mouse position into window system cut buffer.
Save in Emacs kill ring also."
  (let ((opoint (point))
	beg end)
    (if (coordinates-in-window-p arg (selected-window))
	(unwind-protect
	    (progn
	      (x-mouse-set-point arg)
	      (setq beg (min opoint (point))
		    end (max opoint (point)))
	      (if (not (= beg end))
		  (progn
		    (push-mark nil t)
		    (x-store-cut-buffer (buffer-substring beg end))
		    (and kill
			 (kill-region beg end)))))
	  (goto-char opoint))
      (message "Mouse not in selected window"))))