gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mouse+.el - extensions to GNU `mouse.el'


From: Drew Adams
Subject: mouse+.el - extensions to GNU `mouse.el'
Date: Tue, 16 Jan 2001 21:35:20 -0500

;;; mouse+.el --- Extensions to `mouse.el'.
;; 
;; Emacs Lisp Archive Entry
;; Filename: mouse+.el
;; Description: Extensions to `mouse.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1996-2001, Drew Adams, all rights reserved.
;; Created: Fri Jun 28 14:47:12 1996
;; Version: $Id: mouse+.el,v 1.4 2001/01/09 01:52:34 dadams Exp $
;; Last-Updated: Mon Jan  8 17:52:19 2001
;;           By: dadams
;;     Update #: 27
;; Keywords: mouse
;; Compatibility: GNU Emacs 20.x
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Commentary: 
;; 
;;    Extensions to `mouse.el'.
;;
;;
;;  ***** NOTE: The following functions defined in `mouse.el' have
;;              been REDEFINED HERE:
;;
;;  `mouse-choose-completion' - Iconify *Completions* frame afterward.
;;  `mouse-tear-off-window' - Don't delete window if it is alone in
;;                            frame.  Instead, clone frame and window.
;;
;;
;;  This file should be loaded after loading the standard GNU file
;;  `mouse.el'.  So, in your `~/.emacs' file, do this:
;;  (eval-after-load "mouse" '(progn (require 'mouse+))
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Change log:
;; 
;; RCS $Log: mouse+.el,v $
;; RCS Revision 1.4  2001/01/09 01:52:34  dadams
;; RCS Adapted file header for Emacs Lisp Archive.
;; RCS
;; RCS Revision 1.3  2001/01/03 17:41:47  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.2  2001/01/03 00:58:46  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.1  2000/09/14 17:23:20  dadams
;; RCS Initial revision
;; RCS
; Revision 1.2  1999/03/17  15:05:33  dadams
; Removed: mouse-choose-completion.
;
; Revision 1.1  1997/03/20  12:53:18  dadams
; Initial revision
;
; Revision 1.1  1996/07/01  09:55:00  dadams
; Initial revision
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Code:


(require 'mouse)
(require 'cl) ;; when, unless

(provide 'mouse+)

;;;;;;;;;;;;;;;;;;;;;;



;; REPLACES ORIGINAL in `mouse.el':
;; Only delete window if it is not the only one in frame.
;; Otherwise, this clones the frame and window.
;;;###autoload
(defun mouse-tear-off-window (click)
  "Create a new frame displaying buffer of window clicked on.
If window is not the only one in frame, then delete it.
Otherwise, this command effectively clones the frame and window."
  (interactive "e")
  (mouse-minibuffer-check click)
  (let* ((window (posn-window (event-start click)))
         (buf (window-buffer window))
         (frame (make-frame)))
    (select-frame frame)
    (switch-to-buffer buf)
    (save-window-excursion (select-window window)
                           (unless (one-window-p) (delete-window window)))))


;; REPLACES ORIGINAL in `mouse.el': 
;; Iconify *Completions* frame after choosing completion.
;; Free variable COMPLETION-REFERENCE-BUFFER is defined in `simple.el'.
;  ;;;###autoload
;(defun mouse-choose-completion (event)
;  "Click on an alternative in the `*Completions*' buffer to choose it."
;  (interactive "e")
;  ;; Give temporary modes such as isearch a chance to turn off.
;  (run-hooks 'mouse-leave-buffer-hook)
;  (let ((buffer (window-buffer))
;        choice
;       base-size)
;    (save-excursion
;      (set-buffer (window-buffer (posn-window (event-start event))))
;      (when completion-reference-buffer   ; Defined in `simple.el'.
;        (setq buffer completion-reference-buffer))
;      (setq base-size completion-base-size)
;      (save-excursion
;       (goto-char (posn-point (event-start event)))
;       (let (beg end)
;         (when (and (not (eobp)) (get-text-property (point) 'mouse-face))
;            (setq end (point))
;            (setq beg (1+ (point))))
;         (unless beg (error "No completion here."))
;         (setq beg (previous-single-property-change beg 'mouse-face))
;         (setq end (or (next-single-property-change end 'mouse-face)
;                       (point-max)))
;         (setq choice (buffer-substring beg end)))))
;    (save-window-excursion
;      (select-window (posn-window (event-start event)))
;      (when (one-window-p t 'selected-frame) (iconify-frame (selected-frame))))
;    (choose-completion-string choice buffer base-size))) ; In `simple+.el'.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; `mouse+.el' ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]