[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Minor enhancements to Emacs packages
From: |
Ziemowit Laski |
Subject: |
Re: Minor enhancements to Emacs packages |
Date: |
Thu, 22 Feb 2001 21:12:29 -0800 |
FEATURE REQUEST/IMPLEMENTATION
Ok, here are the context diffs for the changes I previously mentioned. I have
perfunctorily tested these on Emacs 20.7 under RedHat Linux 7 and on Emacs 20.7
under Windows 2000. Hopefully some of you Emacs/Lisp gurus out there (which I'm
definitely not) will take a look at these and decide if they're worth merging
into
the main line.
mouse.el/menu-bar.el: I've added a defcustom variable that allows disabling
copy-yank-as-kill for text selected with the mouse (the user must cut/copy
explicitly, like on MacOS or Windows).
*** mouse.el.orig Mon Feb 19 23:56:30 2001
--- mouse.el Tue Feb 20 00:23:02 2001
***************
*** 37,42 ****
--- 37,50 ----
;;; Indent track-mouse like progn.
(put 'track-mouse 'lisp-indent-function 0)
+ (defcustom mouse-select-implies-copy t
+ "*If non-nil, regions selected with the mouse are automatically copied
+ into the kill ring for subsequent operations (this is the default). If
+ nil, the user must explicitly cut or copy the region, as is the norm on
+ Windows and MacOS boxes."
+ :type 'boolean
+ :group 'mouse)
+
(defcustom mouse-yank-at-point nil
"*If non-nil, mouse yank commands yank at point instead of at click."
:type 'boolean
***************
*** 634,640 ****
(goto-char region-termination)
;; Don't let copy-region-as-kill set deactivate-mark.
(let (deactivate-mark)
! (copy-region-as-kill (point) (mark t)))
(let ((buffer (current-buffer)))
(mouse-show-mark)
;; mouse-show-mark can call read-event,
--- 642,648 ----
(goto-char region-termination)
;; Don't let copy-region-as-kill set deactivate-mark.
(let (deactivate-mark)
! (if mouse-select-implies-copy (copy-region-as-kill (point)
(mark t))))
(let ((buffer (current-buffer)))
(mouse-show-mark)
;; mouse-show-mark can call read-event,
*** menu-bar.el.orig Tue Feb 20 00:28:28 2001
--- menu-bar.el Tue Feb 20 00:29:56 2001
***************
*** 281,287 ****
(defun menu-bar-kill-ring-save (beg end)
(interactive "r")
! (if (mouse-region-match)
(message "Selecting a region with the mouse does `copy' automatically")
(kill-ring-save beg end)))
--- 281,287 ----
(defun menu-bar-kill-ring-save (beg end)
(interactive "r")
! (if (and (mouse-region-match) mouse-select-implies-copy)
(message "Selecting a region with the mouse does `copy' automatically")
(kill-ring-save beg end)))
gud.el: I've added a defcustom variable that controls if, when a debugging
session is launched, the current directory is switched to that of the
executable being debugged; also, the command name for gdb (plus any
parameters) may now be specified in another defcustom var.
*** gud.el.orig Mon Feb 19 23:51:52 2001
--- gud.el Sun Feb 18 21:28:32 2001
***************
*** 57,62 ****
--- 57,78 ----
:type 'string
:group 'gud)
+ (defcustom gud-gdb-command-name "gdb --quiet"
+ "This is the command used by the `gdb' command to start gdb from within
+ Emacs; it may include command-line options that should always be passed to
+ gdb."
+ :type 'string
+ :group 'gud)
+
+ (defcustom gud-switch-dir-upon-invocation t
+ "*Non-nil means that when a debugging session is started, the subprocess
+ should switch to the directory containing the executable named on the
+ command-line (if any) before starting the debugger itself. This is the
+ traditional behavior of the `gdb', `xdb', `dbx', `sdb', `perldb', `pdb' and
+ `jdb' commands, but may be changed by setting this variable to nil."
+ :type 'boolean
+ :group 'gud)
+
(global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh)
(define-key ctl-x-map " " 'gud-break) ;; backward compatibility hack
***************
*** 351,364 ****
;;;###autoload
(defun gdb (command-line)
! "Run gdb on program FILE in buffer *gud-FILE*.
! The directory containing FILE becomes the initial working directory
! and source-file directory for your debugger."
(interactive
(list (read-from-minibuffer "Run gdb (like this): "
(if (consp gud-gdb-history)
(car gud-gdb-history)
! "gdb ")
gdb-minibuffer-local-map nil
'(gud-gdb-history . 1))))
--- 367,383 ----
;;;###autoload
(defun gdb (command-line)
! "Run gdb, as specified by `gud-gdb-command-name', on program FILE in
! buffer *gud-FILE*.
! If the variable 'gud-switch-dir-upon-invocation' is non-nil (which is the
! default), the directory containing FILE becomes the initial working directory
and
! source-file directory for your debugger; otherwise, the working directory is
! unchanged."
(interactive
(list (read-from-minibuffer "Run gdb (like this): "
(if (consp gud-gdb-history)
(car gud-gdb-history)
! gud-gdb-command-name)
gdb-minibuffer-local-map nil
'(gud-gdb-history . 1))))
***************
*** 2078,2090 ****
(filepart (and file-word (concat "-" (file-name-nondirectory file)))))
(pop-to-buffer (concat "*gud" filepart "*"))
;; Set default-directory to the file's directory.
! (and file-word
;; Don't set default-directory if no directory was specified.
;; In that case, either the file is found in the current directory,
;; in which case this setq is a no-op,
;; or it is found by searching PATH,
;; in which case we don't know what directory it was found in.
! (file-name-directory file)
(setq default-directory (file-name-directory file)))
(or (bolp) (newline))
(insert "Current directory is " default-directory "\n")
--- 2097,2109 ----
(filepart (and file-word (concat "-" (file-name-nondirectory file)))))
(pop-to-buffer (concat "*gud" filepart "*"))
;; Set default-directory to the file's directory.
! (and file-word (and gud-switch-dir-upon-invocation
;; Don't set default-directory if no directory was specified.
;; In that case, either the file is found in the current directory,
;; in which case this setq is a no-op,
;; or it is found by searching PATH,
;; in which case we don't know what directory it was found in.
! (file-name-directory file))
(setq default-directory (file-name-directory file)))
(or (bolp) (newline))
(insert "Current directory is " default-directory "\n")
That's it. Perhaps the same functionality could be encoded in a separate Lisp
file, but I couldn't figure out how to do this without duplicating a whole lot
of
source code.
--Zem
"Stefan Monnier " wrote:
> The following message is a courtesy copy of an article
> that has been posted to gnu.emacs.bug as well.
>
> >>>>> "Ziemowit" == Ziemowit Laski <zlaski@speakeasy.org> writes:
> > I've made small enhancements to three packages (mouse.el, menu-bar.el and
> > gud.el) that ship with GNU Emacs and was wondering whom I should send them
> > to
> > and in which format (old + new, just diffs, etc.).
>
> The preferred way is to send context diffs. If you want them included
> you should send them here (i.e. gnu.emacs.bugs) as feature requests.
>
> Stefan
>
> PS: otherwise you can send them to gnu.emacs.sources.