]> code.delx.au - gnu-emacs/blobdiff - lisp/emulation/edt.el
* net/tramp-fish.el (tramp-fish-handle-delete-directory):
[gnu-emacs] / lisp / emulation / edt.el
index d43c118f4e1b2a30ed278028b1acbf1434b62c87..6457925efa65e3921cc29261ccc683e53dda0992 100644 (file)
@@ -1,7 +1,7 @@
 ;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs 19
 
 ;; Copyright (C) 1986, 1992, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com>
 ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com>
@@ -9,20 +9,18 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs 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 3, or (at your
-;; option) any later version.
+;; GNU Emacs 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 3 of the License, or
+;; (at your option) any later version.
 
-;; GNU Emacs 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.
+;; GNU Emacs 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 GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 
 \f
@@ -317,15 +315,17 @@ This means that an edt-user.el file was found in the user's `load-path'.")
 (defconst edt-window-system (if (featurep 'emacs) window-system (console-type))
   "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).")
 
-(defconst edt-xserver (if (eq edt-window-system 'x)
-                         (if (featurep 'xemacs)
-                             ;; The Cygwin window manager has a `/' in its
-                             ;; name, which breaks the generated file name of
-                             ;; the custom key map file.  Replace `/' with a
-                             ;; `-' to work around that.
-                             (replace-in-string (x-server-vendor) "[ /]" "-")
-                           (subst-char-in-string ?/ ?- (subst-char-in-string ?  ?- (x-server-vendor))))
-                       nil)
+(declare-function x-server-vendor "xfns.c" (&optional terminal))
+
+(defconst edt-xserver (when (eq edt-window-system 'x)
+                       ;; The Cygwin window manager has a `/' in its
+                       ;; name, which breaks the generated file name of
+                       ;; the custom key map file.  Replace `/' with a
+                       ;; `-' to work around that.
+                       (if (featurep 'xemacs)
+                           (replace-in-string (x-server-vendor) "[ /]" "-")
+                         (replace-regexp-in-string "[ /]" "-"
+                                                   (x-server-vendor))))
   "Indicates X server vendor name, if applicable.")
 
 (defvar edt-keys-file nil
@@ -334,7 +334,6 @@ This means that an edt-user.el file was found in the user's `load-path'.")
 (defvar edt-last-copied-word nil
   "Last word that the user copied.")
 
-(defvar zmacs-region-stays)
 \f
 ;;;;
 ;;;; EDT Emulation Commands
@@ -629,7 +628,8 @@ Argument NUM is the number of lines to move."
   (interactive "p")
   (edt-check-prefix num)
   (let ((beg (edt-current-line)))
-    (forward-line num)
+    ;; We're deliberately using next-line instead of forward-line.
+    (with-no-warnings (next-line num))
     (edt-bottom-check beg num))
   (if (featurep 'xemacs) (setq zmacs-region-stays t)))
 
@@ -639,7 +639,8 @@ Argument NUM is the number of lines to move."
   (interactive "p")
   (edt-check-prefix num)
   (let ((beg (edt-current-line)))
-    (forward-line (- num))
+    ;; We're deliberately using previous-line instead of forward-line.
+    (with-no-warnings (previous-line num))
     (edt-top-check beg num))
   (if (featurep 'xemacs) (setq zmacs-region-stays t)))
 
@@ -1271,7 +1272,7 @@ Argument BOTTOM is the bottom margin in number of lines or percent of window."
              (/ (1- (+ (* (string-to-number bottom) 100) (window-height)))
                 (window-height)))))
   ;; report scroll margin settings if running interactively
-  (and (interactive-p)
+  (and (called-interactively-p 'interactive)
        (message "Scroll margins set.  Top = %s%%, Bottom = %s%%"
                edt-top-scroll-margin edt-bottom-scroll-margin)))
 
@@ -1619,7 +1620,7 @@ Argument NUM is the percentage into the buffer to move."
     (fill-region (point) (mark))))
 
 
-(declare-function c-mark-function "../progmodes/cc-cmds" ())
+(declare-function c-mark-function "cc-cmds" ())
 ;;;
 ;;; MARK SECTION WISELY
 ;;;
@@ -2212,7 +2213,11 @@ Optional argument USER-SETUP non-nil means  called from function
         (fset 'edt-emulation-on (symbol-function 'edt-select-user-global-map)))
     (progn
       (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map))
-      (edt-select-default-global-map))))
+      (edt-select-default-global-map)))
+  ;; We need to share `global-buffers-menu-map' with the saved global
+  ;; keymap, because `menu-bar-update-buffers' directly changes it.
+  (define-key (current-global-map) [menu-bar buffer]
+    (cons "Buffers" global-buffers-menu-map)))
 
 (defun edt-user-emulation-setup ()
   "Setup user custom emulation of DEC's EDT editor."
@@ -2643,7 +2648,7 @@ G-C-\\: Split Window                     |  FNDNXT  |   Yank   |   CUT    |
 (defun edt-electric-helpify (fun)
   (let ((name "*Help*"))
     (if (save-window-excursion
-          (let* ((p (symbol-function 'print-help-return-message))
+          (let* ((p (symbol-function 'help-print-return-message))
                  (b (get-buffer name))
                  (m (buffer-modified-p b)))
             (and b (not (get-buffer-window b))
@@ -2652,20 +2657,18 @@ G-C-\\: Split Window                     |  FNDNXT  |   Yank   |   CUT    |
                 (progn
                   (message "%s..." (capitalize (symbol-name fun)))
                   (and b
-                       (save-excursion
-                         (set-buffer b)
+                       (with-current-buffer b
                          (set-buffer-modified-p t)))
-                  (fset 'print-help-return-message 'ignore)
+                  (fset 'help-print-return-message 'ignore)
                   (call-interactively fun)
                   (and (get-buffer name)
                        (get-buffer-window (get-buffer name))
                        (or (not b)
                            (not (eq b (get-buffer name)))
                            (not (buffer-modified-p b)))))
-              (fset 'print-help-return-message p)
+              (fset 'help-print-return-message p)
               (and b (buffer-name b)
-                   (save-excursion
-                     (set-buffer b)
+                   (with-current-buffer b
                      (set-buffer-modified-p m))))))
         (with-electric-help 'delete-other-windows name t))))
 
@@ -2705,5 +2708,5 @@ G-C-\\: Split Window                     |  FNDNXT  |   Yank   |   CUT    |
 
 (provide 'edt)
 
-;;; arch-tag: 18d1c54f-6900-4078-8bbc-7c2292f48941
+;; arch-tag: 18d1c54f-6900-4078-8bbc-7c2292f48941
 ;;; edt.el ends here