aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib-src/etags.c20
-rw-r--r--lisp/emacs-lisp/autoload.el44
-rw-r--r--lisp/emacs-lisp/edebug.el32
-rw-r--r--lisp/emacs-lisp/lisp-mode.el20
-rw-r--r--lisp/frame.el6
-rw-r--r--lisp/play/blackbox.el5
-rw-r--r--lisp/progmodes/compile.el27
-rw-r--r--lisp/progmodes/etags.el24
-rw-r--r--lisp/progmodes/inf-lisp.el180
-rw-r--r--lisp/simple.el9
-rw-r--r--lisp/term/x-win.el16
-rw-r--r--lisp/textmodes/text-mode.el16
-rw-r--r--src/.gdbinit8
-rw-r--r--src/alloc.c2
-rw-r--r--src/eval.c42
-rw-r--r--src/fns.c209
-rw-r--r--src/keyboard.c10
-rw-r--r--src/search.c55
-rw-r--r--src/xdisp.c12
-rw-r--r--src/xfns.c10
-rw-r--r--src/xterm.c15
21 files changed, 411 insertions, 351 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 69d29109b69..ae4e5485e09 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -410,7 +410,7 @@ DEFINEST definedef;
410 * for self-documentation only. 410 * for self-documentation only.
411 */ 411 */
412#define LEVEL_OK_FOR_FUNCDEF() \ 412#define LEVEL_OK_FOR_FUNCDEF() \
413 (level==0 || c_ext && level==1 && structdef==sinbody) 413 (level==0 || (c_ext && level==1 && structdef==sinbody))
414 414
415/* 415/*
416 * next_token_is_func 416 * next_token_is_func
@@ -1283,7 +1283,7 @@ put_entries (node)
1283 fprintf (stdout, "%s %s %d\n", 1283 fprintf (stdout, "%s %s %d\n",
1284 node->name, node->file, (node->lno + 63) / 64); 1284 node->name, node->file, (node->lno + 63) / 64);
1285 else 1285 else
1286 fprintf (stdout, "%-16s%4d %-16s %s\n", 1286 fprintf (stdout, "%-16s %3d %-16s %s\n",
1287 node->name, node->lno, node->file, node->pat); 1287 node->name, node->lno, node->file, node->pat);
1288 1288
1289 /* Output subentries that follow this one */ 1289 /* Output subentries that follow this one */
@@ -1468,7 +1468,8 @@ C_entries (c_ext)
1468 { 1468 {
1469 if (c == '"') 1469 if (c == '"')
1470 inquote = FALSE; 1470 inquote = FALSE;
1471 continue; 1471 else if (c == '\\')
1472 c = *lp++;
1472 } 1473 }
1473 else if (inchar) 1474 else if (inchar)
1474 { 1475 {
@@ -1493,7 +1494,8 @@ C_entries (c_ext)
1493 } 1494 }
1494 else if (c_ext && *lp == '/') 1495 else if (c_ext && *lp == '/')
1495 { 1496 {
1496 c = 0; /* C++ comment: skip rest of line */ 1497 c = 0;
1498 break;
1497 } 1499 }
1498 continue; 1500 continue;
1499 case '#': 1501 case '#':
@@ -1886,7 +1888,10 @@ consider_token (c, lpp, tokp, is_func, c_ext, level)
1886 /* Detect GNUmacs's function-defining macros. */ 1888 /* Detect GNUmacs's function-defining macros. */
1887 if (definedef == dnone) 1889 if (definedef == dnone)
1888 { 1890 {
1889 if (strneq (tokp->p, "DEF", 3)) 1891 if (strneq (tokp->p, "DEF", 3)
1892 || strneq (tokp->p, "ENTRY", 5)
1893 || strneq (tokp->p, "SYSCALL", 7)
1894 || strneq (tokp->p, "PSEUDO", 6))
1890 { 1895 {
1891 next_token_is_func = TRUE; 1896 next_token_is_func = TRUE;
1892 goto badone; 1897 goto badone;
@@ -2084,7 +2089,10 @@ getit ()
2084 2089
2085 while (isspace (*dbp)) 2090 while (isspace (*dbp))
2086 dbp++; 2091 dbp++;
2087 if (*dbp == 0 || (!isalpha (*dbp)) && (*dbp != '_') && (*dbp != '$')) 2092 if (*dbp == 0
2093 || (!isalpha (*dbp)
2094 && *dbp != '_'
2095 && *dbp != '$'))
2088 return; 2096 return;
2089 for (cp = dbp + 1; *cp && (isalpha (*cp) || isdigit (*cp) 2097 for (cp = dbp + 1; *cp && (isalpha (*cp) || isdigit (*cp)
2090 || (*cp == '_') || (*cp == '$')); cp++) 2098 || (*cp == '_') || (*cp == '$')); cp++)
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index b399a29bfa0..767621adbd2 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -59,14 +59,29 @@ the section of autoloads for a file.")
59(defconst generate-autoload-section-trailer "\n;;;***\n" 59(defconst generate-autoload-section-trailer "\n;;;***\n"
60 "String which indicates the end of the section of autoloads for a file.") 60 "String which indicates the end of the section of autoloads for a file.")
61 61
62;; Forms which have doc-strings which should be printed specially. 62;;; Forms which have doc-strings which should be printed specially.
63;; A doc-string-elt property of ELT says that (nth ELT FORM) is 63;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
64;; the doc-string in FORM. 64;;; the doc-string in FORM.
65;; Note: defconst and defvar should NOT be marked in this way. 65;;;
66;; We don't want to produce defconsts and defvars that make-docfile can 66;;; There used to be the following note here:
67;; grok, because then it would grok them twice, once in foo.el (where they 67;;; ;;; Note: defconst and defvar should NOT be marked in this way.
68;; are given with ;;;###autoload) and once in loaddefs.el. 68;;; ;;; We don't want to produce defconsts and defvars that
69;;; ;;; make-docfile can grok, because then it would grok them twice,
70;;; ;;; once in foo.el (where they are given with ;;;###autoload) and
71;;; ;;; once in loaddefs.el.
72;;;
73;;; Counter-note: Yes, they should be marked in this way.
74;;; make-docfile only processes those files that are loaded into the
75;;; dumped Emacs, and those files should never have anything
76;;; autoloaded here. The above-feared problem only occurs with files
77;;; which have autoloaded entries *and* are processed by make-docfile;
78;;; there should be no such files.
79
69(put 'autoload 'doc-string-elt 3) 80(put 'autoload 'doc-string-elt 3)
81(put 'defun 'doc-string-elt 3)
82(put 'defvar 'doc-string-elt 3)
83(put 'defconst 'doc-string-elt 3)
84(put 'defmacro 'doc-string-elt 3)
70 85
71(defun generate-file-autoloads (file) 86(defun generate-file-autoloads (file)
72 "Insert at point a loaddefs autoload section for FILE. 87 "Insert at point a loaddefs autoload section for FILE.
@@ -86,6 +101,21 @@ are used."
86 (floating-output-format "%20e") 101 (floating-output-format "%20e")
87 (done-any nil) 102 (done-any nil)
88 output-end) 103 output-end)
104
105 ;; If the autoload section we create here uses an absolute
106 ;; pathname for FILE in its header, and then Emacs is installed
107 ;; under a different path on another system,
108 ;; `update-autoloads-here' won't be able to find the files to be
109 ;; autoloaded. So, if FILE is in the same directory or a
110 ;; subdirectory of the current buffer's file, we'll make it
111 ;; relative to the current buffer's directory.
112 (setq file (expand-file-name file))
113 (if (and (< (length default-directory) (length file))
114 (string= default-directory
115 (substring file 0 (length default-directory))))
116 (progn
117 (setq file (substring file (length default-directory)))))
118
89 (message "Generating autoloads for %s..." file) 119 (message "Generating autoloads for %s..." file)
90 (save-excursion 120 (save-excursion
91 (set-buffer inbuf) 121 (set-buffer inbuf)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index d586367933b..2302f1704f8 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -175,7 +175,6 @@
175;; Put edebug.el in some directory in your load-path and byte-compile it. 175;; Put edebug.el in some directory in your load-path and byte-compile it.
176 176
177;; Put the following forms in your .emacs file. 177;; Put the following forms in your .emacs file.
178;; (setq edebug-global-prefix "...whatever you want") ; default is C-xX
179;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun) 178;; (define-key emacs-lisp-mode-map "\^Xx" 'edebug-defun)
180;; (autoload 'edebug-defun "edebug") 179;; (autoload 'edebug-defun "edebug")
181;; (autoload 'edebug-debug "edebug") 180;; (autoload 'edebug-debug "edebug")
@@ -459,17 +458,32 @@ if an error occurs, point is left at the error."
459 )) 458 ))
460 459
461 460
462;; The standard eval-current-buffer doesn't use eval-region. 461(defun edebug-eval-current-buffer (&optional edebug-e-c-b-output)
463(if (not (fboundp 'edebug-emacs-eval-current-buffer))
464 (fset 'edebug-emacs-eval-current-buffer
465 (symbol-function 'eval-current-buffer)))
466;; (fset 'eval-current-buffer (symbol-function 'edebug-emacs-eval-current-buffer))
467
468(defun eval-current-buffer (&optional edebug-e-c-b-output)
469 "Call eval-region on the whole buffer." 462 "Call eval-region on the whole buffer."
470 (interactive) 463 (interactive)
471 (eval-region (point-min) (point-max) edebug-e-c-b-output)) 464 (eval-region (point-min) (point-max) edebug-e-c-b-output))
472 465
466(defun edebug-eval-buffer (&optional buffer edebug-e-c-b-output)
467 "Call eval-region on the whole buffer."
468 (interactive "bEval buffer: ")
469 (save-excursion
470 (set-buffer buffer)
471 (eval-region (point-min) (point-max) edebug-e-c-b-output)))
472
473;; The standard eval-current-buffer doesn't use eval-region.
474(if (and (fboundp 'eval-current-buffer)
475 (not (fboundp 'edebug-emacs-eval-current-buffer)))
476 (progn
477 (fset 'edebug-emacs-eval-current-buffer
478 (symbol-function 'eval-current-buffer))
479 (fset 'eval-current-buffer 'edebug-eval-current-buffer)))
480(if (and (fboundp 'eval-buffer)
481 (not (fboundp 'edebug-emacs-eval-buffer)))
482 (progn
483 (fset 'edebug-emacs-eval-buffer
484 (symbol-function 'eval-buffer))
485 (fset 'eval-buffer 'edebug-eval-buffer)))
486
473 487
474 488
475;;;====================================================================== 489;;;======================================================================
@@ -498,6 +512,7 @@ if an error occurs, point is left at the error."
498;;; for more details. 512;;; for more details.
499 513
500 514
515;;;###autoload
501(defun edebug-defun () 516(defun edebug-defun ()
502 "Evaluate defun or defmacro, like eval-defun, but with edebug calls. 517 "Evaluate defun or defmacro, like eval-defun, but with edebug calls.
503Print its name in the minibuffer and leave point after any error it finds, 518Print its name in the minibuffer and leave point after any error it finds,
@@ -2416,6 +2431,7 @@ Global commands prefixed by global-edbug-prefix:
2416;; Note that debug and its utilities must be byte-compiled to work, since 2431;; Note that debug and its utilities must be byte-compiled to work, since
2417;; they depend on the backtrace looking a certain way. 2432;; they depend on the backtrace looking a certain way.
2418 2433
2434;;;###autoload
2419(defun edebug-debug (&rest debugger-args) 2435(defun edebug-debug (&rest debugger-args)
2420 "Replacement for debug. 2436 "Replacement for debug.
2421If an error or quit occurred and we are running an edebugged function, 2437If an error or quit occurred and we are running an edebugged function,
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index f6fb07b0d2f..d3c1c519460 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -490,9 +490,11 @@ of the start of the containing expression."
490If optional arg ENDPOS is given, indent each line, stopping when 490If optional arg ENDPOS is given, indent each line, stopping when
491ENDPOS is encountered." 491ENDPOS is encountered."
492 (interactive) 492 (interactive)
493 (let ((indent-stack (list nil)) (next-depth 0) last-depth bol 493 (let ((indent-stack (list nil))
494 outer-loop-done inner-loop-done state this-indent 494 (next-depth 0)
495 (last-point (point))) 495 (starting-point (point))
496 (last-point (point))
497 last-depth bol outer-loop-done inner-loop-done state this-indent)
496 ;; Get error now if we don't have a complete sexp after point. 498 ;; Get error now if we don't have a complete sexp after point.
497 (save-excursion (forward-sexp 1)) 499 (save-excursion (forward-sexp 1))
498 (save-excursion 500 (save-excursion
@@ -529,10 +531,12 @@ ENDPOS is encountered."
529 (setcar (nthcdr 5 state) nil)) 531 (setcar (nthcdr 5 state) nil))
530 (setq inner-loop-done t))) 532 (setq inner-loop-done t)))
531 (and endpos 533 (and endpos
532 (while (<= next-depth 0) 534 (<= next-depth 0)
533 (setq indent-stack (append indent-stack (list nil))) 535 (progn
534 (setq next-depth (1+ next-depth)) 536 (setq indent-stack (append indent-stack
535 (setq last-depth (1+ last-depth)))) 537 (make-list (- next-depth) nil))
538 last-depth (- last-depth next-depth)
539 next-depth 0)))
536 (or outer-loop-done 540 (or outer-loop-done
537 (setq outer-loop-done (<= next-depth 0))) 541 (setq outer-loop-done (<= next-depth 0)))
538 (if outer-loop-done 542 (if outer-loop-done
@@ -557,7 +561,7 @@ ENDPOS is encountered."
557 (setq this-indent (car indent-stack)) 561 (setq this-indent (car indent-stack))
558 (let ((val (calculate-lisp-indent 562 (let ((val (calculate-lisp-indent
559 (if (car indent-stack) (- (car indent-stack)) 563 (if (car indent-stack) (- (car indent-stack))
560 last-point)))) 564 starting-point))))
561 (if (integerp val) 565 (if (integerp val)
562 (setcar indent-stack 566 (setcar indent-stack
563 (setq this-indent val)) 567 (setq this-indent val))
diff --git a/lisp/frame.el b/lisp/frame.el
index e756f9d0c2b..e8a52af962f 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -264,8 +264,10 @@ under the X Window System."
264 (list (cons 'horizontal-scroll-bar toggle)))) 264 (list (cons 'horizontal-scroll-bar toggle))))
265 265
266;;;; Key bindings 266;;;; Key bindings
267(define-prefix-command 'ctl-x-5-map) 267(defvar ctl-x-5-map (make-sparse-keymap)
268(define-key ctl-x-map "5" 'ctl-x-5-map) 268 "Keymap for screen commands.")
269(fset 'ctl-x-5-prefix ctl-x-5-map)
270(define-key ctl-x-map "5" 'ctl-x-5-prefix)
269 271
270(define-key ctl-x-5-map "2" 'new-screen) 272(define-key ctl-x-5-map "2" 'new-screen)
271(define-key ctl-x-5-map "0" 'delete-screen) 273(define-key ctl-x-5-map "0" 'delete-screen)
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index 59a21a25708..002a33ec37f 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -1,12 +1,12 @@
1;;; blackbox.el --- blackbox game in Emacs Lisp 1;;; blackbox.el --- blackbox game in Emacs Lisp
2 2
3;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 1, or (at your option) 9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version. 10;; any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
@@ -114,6 +114,7 @@ The usual mnemonic keys move the cursor around the box.
114 (setq major-mode 'blackbox-mode) 114 (setq major-mode 'blackbox-mode)
115 (setq mode-name "Blackbox")) 115 (setq mode-name "Blackbox"))
116 116
117;;;###autoload
117(defun blackbox (num) 118(defun blackbox (num)
118 "Play blackbox. Optional prefix argument is the number of balls; 119 "Play blackbox. Optional prefix argument is the number of balls;
119the default is 4. 120the default is 4.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index a71ac512dd4..ac1be6b9773 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1,4 +1,4 @@
1;;; compile.el --- run compiler as inferior of Emacs, and parse its error messages. 1;;; compile.el --- run compiler as inferior of Emacs, parse error messages.
2 2
3;;;!!! dup removal is broken. 3;;;!!! dup removal is broken.
4 4
@@ -84,21 +84,24 @@ are found.")
84 ("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2) 84 ("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)
85 ;; 4.3BSD lint pass 2 85 ;; 4.3BSD lint pass 2
86 ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8) 86 ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8)
87 ("[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]+[ \t]*\\([0-9]+\\)[:) \t]*$" 1 2) 87 ("[ \t:]+\\([^:( \t\n]+\\)[ \t]*[:(]*(+[ \t]*\\([0-9]+\\))[:) \t]*$" 1 2)
88 ;; 4.3BSD lint pass 3 88 ;; 4.3BSD lint pass 3
89 ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used 89 ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used
90 ("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2) 90 ;; This used to be
91 ;; ("[ \t(]+\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2)
92 ;; which is regexp Impressionism - it matches almost anything!
93 ("([ \t]*\\([^:( \t\n]+\\)[ \t]*[:(][ \t]*\\([0-9]+\\))" 1 2)
91 ;; Line 45 of "foo.c": bloofel undefined (who does this?) 94 ;; Line 45 of "foo.c": bloofel undefined (who does this?)
92 ("^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"]+\\)\":" 2 1) 95 ("^[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+of[ \t]+\"\\([^\"\n]+\\)\":" 2 1)
93 ;; Apollo cc, 4.3BSD fc 96 ;; Apollo cc, 4.3BSD fc
94 ;; "foo.f", line 3: Error: syntax error near end of statement 97 ;; "foo.f", line 3: Error: syntax error near end of statement
95 ("^\"\\([^\"]+\\)\", line \\([0-9]+\\):" 1 2) 98 ("^\"\\([^\"\n]+\\)\", line \\([0-9]+\\):" 1 2)
96 ;; HP-UX 7.0 fc 99 ;; HP-UX 7.0 fc
97 ;; foo.f :16 some horrible error message 100 ;; foo.f :16 some horrible error message
98 ("\\([^ \t:]+\\)[ \t]*:\\([0-9]+\\)" 1 2) 101 ("^\\([^ \t\n:]+\\)[ \t]*:\\([0-9]+\\)" 1 2)
99 ;; IBM AIX PS/2 C version 1.1 102 ;; IBM AIX PS/2 C version 1.1
100 ;; ****** Error number 140 in line 8 of file errors.c ****** 103 ;; ****** Error number 140 in line 8 of file errors.c ******
101 ("in line \\([0-9]+\\) of file \\([^ ]+[^. ]\\)\\.? " 2 1) 104 ("in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1)
102 ;; IBM AIX lint is too painful to do right this way. File name 105 ;; IBM AIX lint is too painful to do right this way. File name
103 ;; prefixes entire sections rather than being on each line. 106 ;; prefixes entire sections rather than being on each line.
104 ) 107 )
@@ -132,18 +135,18 @@ Typically \"grep -n\" or \"egrep -n\".
132\(The \"-n\" option tells grep to output line numbers.)") 135\(The \"-n\" option tells grep to output line numbers.)")
133 136
134(defconst compilation-enter-directory-regexp 137(defconst compilation-enter-directory-regexp
135 ": Entering directory `\\\(.*\\\)'$" 138 ": Entering directory `\\(.*\\)'$"
136 "Regular expression for a line in the compilation log that 139 "Regular expression for a line in the compilation log that
137changes the current directory. This must contain one \\\(, \\\) pair 140changes the current directory. This must contain one \\(, \\) pair
138around the directory name. 141around the directory name.
139 142
140The default value matches lines printed by the `-w' option of GNU Make.") 143The default value matches lines printed by the `-w' option of GNU Make.")
141 144
142(defconst compilation-leave-directory-regexp 145(defconst compilation-leave-directory-regexp
143 ": Leaving directory `\\\(.*\\\)'$" 146 ": Leaving directory `\\(.*\\)'$"
144 "Regular expression for a line in the compilation log that 147 "Regular expression for a line in the compilation log that
145changes the current directory to a previous value. This may 148changes the current directory to a previous value. This may
146contain one \\\(, \\\) pair around the name of the directory 149contain one \\(, \\) pair around the name of the directory
147being moved from. If it does not, the last directory entered 150being moved from. If it does not, the last directory entered
148\(by a line matching `compilation-enter-directory-regexp'\) is assumed. 151\(by a line matching `compilation-enter-directory-regexp'\) is assumed.
149 152
@@ -343,6 +346,8 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
343 (setq omax (point-max) 346 (setq omax (point-max)
344 opoint (point)) 347 opoint (point))
345 (goto-char omax) 348 (goto-char omax)
349 ;; Record where we put the message, so we can ignore it
350 ;; later on.
346 (insert ?\n mode-name " " msg) 351 (insert ?\n mode-name " " msg)
347 (forward-char -1) 352 (forward-char -1)
348 (insert " at " (substring (current-time-string) 0 19)) 353 (insert " at " (substring (current-time-string) 0 19))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index c7daec726ee..3f2f911daed 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1,12 +1,12 @@
1;;; etags.el --- tags facility for Emacs. 1;;; etags.el --- tags facility for Emacs.
2 2
3;; Copyright (C) 1985, 1986, 1988 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1986, 1988, 1992 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 1, or (at your option) 9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version. 10;; any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
@@ -244,6 +244,26 @@ See documentation of variable tags-file-name."
244;;;###autoload 244;;;###autoload
245(define-key ctl-x-4-map "." 'find-tag-other-window) 245(define-key ctl-x-4-map "." 'find-tag-other-window)
246 246
247;;;###autoload
248(defun find-tag-other-frame (tagname &optional next)
249 "Find tag (in current tag table) whose name contains TAGNAME.
250 Selects the buffer that the tag is contained in in another frame
251and puts point at its definition.
252 If TAGNAME is a null string, the expression in the buffer
253around or before point is used as the tag name.
254 If second arg NEXT is non-nil (interactively, with prefix arg),
255searches for the next tag in the tag table
256that matches the tagname used in the previous find-tag.
257
258See documentation of variable tags-file-name."
259 (interactive (if current-prefix-arg
260 '(nil t)
261 (find-tag-tag "Find tag other window: ")))
262 (let ((pop-up-screens t))
263 (find-tag tagname next t)))
264;;;###autoload
265(define-key ctl-x-5-map "." 'find-tag-other-frame)
266
247(defvar next-file-list nil 267(defvar next-file-list nil
248 "List of files for next-file to process.") 268 "List of files for next-file to process.")
249 269
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 98299190f49..11fc14af064 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -100,11 +100,8 @@
100;;; c-m-x lisp-eval-defun This binding is a gnu convention. 100;;; c-m-x lisp-eval-defun This binding is a gnu convention.
101;;; c-c c-e lisp-eval-defun Send the current defun to Lisp process. 101;;; c-c c-e lisp-eval-defun Send the current defun to Lisp process.
102;;; c-x c-e lisp-eval-last-sexp Send the previous sexp to Lisp process. 102;;; c-x c-e lisp-eval-last-sexp Send the previous sexp to Lisp process.
103;;; c-c m-e lisp-eval-defun-and-go After sending the defun, switch-to-lisp.
104;;; c-c c-r lisp-eval-region Send the current region to Lisp process. 103;;; c-c c-r lisp-eval-region Send the current region to Lisp process.
105;;; c-c m-r lisp-eval-region-and-go After sending the region, switch-to-lisp.
106;;; c-c c-c lisp-compile-defun Compile the current defun in Lisp process. 104;;; c-c c-c lisp-compile-defun Compile the current defun in Lisp process.
107;;; c-c m-c lisp-compile-defun-and-go After compiling defun, switch-to-lisp.
108;;; c-c c-z switch-to-lisp Switch to the Lisp process buffer. 105;;; c-c c-z switch-to-lisp Switch to the Lisp process buffer.
109;;; c-c c-l lisp-load-file (See above. In a Lisp file buffer, default 106;;; c-c c-l lisp-load-file (See above. In a Lisp file buffer, default
110;;; c-c c-k lisp-compile-file is to load/compile the current file.) 107;;; c-c c-k lisp-compile-file is to load/compile the current file.)
@@ -115,7 +112,6 @@
115 112
116;;; cmulisp Fires up the Lisp process. 113;;; cmulisp Fires up the Lisp process.
117;;; lisp-compile-region Compile all forms in the current region. 114;;; lisp-compile-region Compile all forms in the current region.
118;;; lisp-compile-region-and-go After compiling region, switch-to-lisp.
119;;; 115;;;
120;;; CMU Lisp Mode Variables: 116;;; CMU Lisp Mode Variables:
121;;; cmulisp-filter-regexp Match this => don't get saved on input hist 117;;; cmulisp-filter-regexp Match this => don't get saved on input hist
@@ -154,11 +150,8 @@ mode. Default is whitespace followed by 0 or 1 single-letter :keyword
154(define-key lisp-mode-map "\M-\C-x" 'lisp-eval-defun) ; Gnu convention 150(define-key lisp-mode-map "\M-\C-x" 'lisp-eval-defun) ; Gnu convention
155(define-key lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp) ; Gnu convention 151(define-key lisp-mode-map "\C-x\C-e" 'lisp-eval-last-sexp) ; Gnu convention
156(define-key lisp-mode-map "\C-c\C-e" 'lisp-eval-defun) 152(define-key lisp-mode-map "\C-c\C-e" 'lisp-eval-defun)
157(define-key lisp-mode-map "\C-c\M-e" 'lisp-eval-defun-and-go)
158(define-key lisp-mode-map "\C-c\C-r" 'lisp-eval-region) 153(define-key lisp-mode-map "\C-c\C-r" 'lisp-eval-region)
159(define-key lisp-mode-map "\C-c\M-r" 'lisp-eval-region-and-go)
160(define-key lisp-mode-map "\C-c\C-c" 'lisp-compile-defun) 154(define-key lisp-mode-map "\C-c\C-c" 'lisp-compile-defun)
161(define-key lisp-mode-map "\C-c\M-c" 'lisp-compile-defun-and-go)
162(define-key lisp-mode-map "\C-c\C-z" 'switch-to-lisp) 155(define-key lisp-mode-map "\C-c\C-z" 'switch-to-lisp)
163(define-key lisp-mode-map "\C-c\C-l" 'lisp-load-file) 156(define-key lisp-mode-map "\C-c\C-l" 'lisp-load-file)
164(define-key lisp-mode-map "\C-c\C-k" 'lisp-compile-file) ; "kompile" file 157(define-key lisp-mode-map "\C-c\C-k" 'lisp-compile-file) ; "kompile" file
@@ -168,6 +161,37 @@ mode. Default is whitespace followed by 0 or 1 single-letter :keyword
168(define-key lisp-mode-map "\C-c\C-v" 'lisp-show-variable-documentation) 161(define-key lisp-mode-map "\C-c\C-v" 'lisp-show-variable-documentation)
169 162
170 163
164;;; This function exists for backwards compatibility.
165;;; Previous versions of this package bound commands to C-c <letter>
166;;; bindings, which is not allowed by the gnumacs standard.
167
168(defun cmulisp-install-letter-bindings ()
169 "This function binds many cmulisp commands to C-c <letter> bindings,
170where they are more accessible. C-c <letter> bindings are reserved for the
171user, so these bindings are non-standard. If you want them, you should
172have this function called by the cmulisp-load-hook:
173 (setq cmulisp-load-hook '(cmulisp-install-letter-bindings))
174You can modify this function to install just the bindings you want."
175
176 (define-key lisp-mode-map "\C-ce" 'lisp-eval-defun-and-go)
177 (define-key lisp-mode-map "\C-cr" 'lisp-eval-region-and-go)
178 (define-key lisp-mode-map "\C-cc" 'lisp-compile-defun-and-go)
179 (define-key lisp-mode-map "\C-cz" 'switch-to-lisp)
180 (define-key lisp-mode-map "\C-cl" 'lisp-load-file)
181 (define-key lisp-mode-map "\C-ck" 'lisp-compile-file)
182 (define-key lisp-mode-map "\C-ca" 'lisp-show-arglist)
183 (define-key lisp-mode-map "\C-cd" 'lisp-describe-sym)
184 (define-key lisp-mode-map "\C-cf" 'lisp-show-function-documentation)
185 (define-key lisp-mode-map "\C-cv" 'lisp-show-variable-documentation)
186
187 (define-key cmulisp-mode-map "\C-cl" 'lisp-load-file)
188 (define-key cmulisp-mode-map "\C-ck" 'lisp-compile-file)
189 (define-key cmulisp-mode-map "\C-ca" 'lisp-show-arglist)
190 (define-key cmulisp-mode-map "\C-cd" 'lisp-describe-sym)
191 (define-key cmulisp-mode-map "\C-cf" 'lisp-show-function-documentation)
192 (define-key cmulisp-mode-map "\C-cv" 'lisp-show-variable-documentation))
193
194
171(defvar inferior-lisp-program "lisp" 195(defvar inferior-lisp-program "lisp"
172 "*Program name for invoking an inferior Lisp with `cmulisp'.") 196 "*Program name for invoking an inferior Lisp with `cmulisp'.")
173 197
@@ -220,9 +244,9 @@ Lisp source.
220 lisp-eval-region sends the current region to the Lisp process. 244 lisp-eval-region sends the current region to the Lisp process.
221 lisp-compile-region compiles the current region. 245 lisp-compile-region compiles the current region.
222 246
223 lisp-eval-defun-and-go, lisp-compile-defun-and-go, 247 Prefixing the lisp-eval/compile-defun/region commands with
224 lisp-eval-region-and-go, and lisp-compile-region-and-go 248 a \\[universal-argument] causes a switch to the Lisp process buffer after sending
225 switch to the Lisp process buffer after sending their text. 249 the text.
226 250
227Commands: 251Commands:
228Return after the end of the process' output sends the text from the 252Return after the end of the process' output sends the text from the
@@ -262,54 +286,87 @@ to continue it."
262 "Don't save anything matching cmulisp-filter-regexp" 286 "Don't save anything matching cmulisp-filter-regexp"
263 (not (string-match cmulisp-filter-regexp str))) 287 (not (string-match cmulisp-filter-regexp str)))
264 288
265(defun cmulisp () 289(defun cmulisp (cmd)
266 "Run an inferior Lisp process, input and output via buffer *cmulisp*. 290 "Run an inferior Lisp process, input and output via buffer *cmulisp*.
267If there is a process already running in *cmulisp*, just switch to that buffer. 291If there is a process already running in *cmulisp*, just switch to that buffer.
268Takes the program name from the variable inferior-lisp-program. 292With argument, allows you to edit the command line (default is value
293of inferior-lisp-program). Runs the hooks from cmulisp-mode-hook (after the
294comint-mode-hook is run).
269\(Type \\[describe-mode] in the process buffer for a list of commands.)" 295\(Type \\[describe-mode] in the process buffer for a list of commands.)"
270 (interactive) 296 (interactive (list (if current-prefix-arg
271 (cond ((not (comint-check-proc "*cmulisp*")) 297 (read-string "Run lisp: " inferior-lisp-program)
272 (set-buffer (make-comint "cmulisp" inferior-lisp-program)) 298 inferior-lisp-program)))
299 (if (not (comint-check-proc "*cmulisp*"))
300 (let ((cmdlist (cmulisp-args-to-list cmd)))
301 (set-buffer (apply (function make-comint) "cmulisp" (car cmdlist) nil
302 (cdr cmdlist)))
273 (cmulisp-mode))) 303 (cmulisp-mode)))
274 (setq cmulisp-buffer "*cmulisp*") 304 (setq cmulisp-buffer "*cmulisp*")
275 (switch-to-buffer "*cmulisp*")) 305 (switch-to-buffer "*cmulisp*"))
276 306
277(defun lisp-eval-region (start end) 307;;; Break a string up into a list of arguments.
278 "Send the current region to the inferior Lisp process." 308;;; This will break if you have an argument with whitespace, as in
279 (interactive "r") 309;;; string = "-ab +c -x 'you lose'".
310(defun cmulisp-args-to-list (string)
311 (let ((where (string-match "[ \t]" string)))
312 (cond ((null where) (list string))
313 ((not (= where 0))
314 (cons (substring string 0 where)
315 (tea-args-to-list (substring string (+ 1 where)
316 (length string)))))
317 (t (let ((pos (string-match "[^ \t]" string)))
318 (if (null pos)
319 nil
320 (cmulsip-args-to-list (substring string pos
321 (length string)))))))))
322
323(defun lisp-eval-region (start end &optional and-go)
324 "Send the current region to the inferior Lisp process.
325Prefix argument means switch-to-lisp afterwards."
326 (interactive "r\nP")
280 (comint-send-region (cmulisp-proc) start end) 327 (comint-send-region (cmulisp-proc) start end)
281 (comint-send-string (cmulisp-proc) "\n")) 328 (comint-send-string (cmulisp-proc) "\n")
329 (if and-go (switch-to-lisp t)))
282 330
283(defun lisp-eval-defun () 331(defun lisp-eval-defun (&optional and-go)
284 "Send the current defun to the inferior Lisp process." 332 "Send the current defun to the inferior Lisp process.
285 (interactive) 333Prefix argument means switch-to-lisp afterwards."
334 (interactive "P")
286 (save-excursion 335 (save-excursion
287 (end-of-defun) 336 (end-of-defun)
288 (let ((end (point))) 337 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
289 (beginning-of-defun) 338 (let ((end (point)))
290 (lisp-eval-region (point) end)))) 339 (beginning-of-defun)
340 (lisp-eval-region (point) end)))
341 (if and-go (switch-to-lisp t)))
291 342
292(defun lisp-eval-last-sexp () 343(defun lisp-eval-last-sexp (&optional and-go)
293 "Send the previous sexp to the inferior Lisp process." 344 "Send the previous sexp to the inferior Lisp process.
294 (interactive) 345Prefix argument means switch-to-lisp afterwards."
295 (lisp-eval-region (save-excursion (backward-sexp) (point)) (point))) 346 (interactive "P")
347 (lisp-eval-region (save-excursion (backward-sexp) (point)) (point) and-go))
296 348
297;;; CommonLisp COMPILE sux. 349;;; Common Lisp COMPILE sux.
298(defun lisp-compile-region (start end) 350(defun lisp-compile-region (start end &optional and-go)
299 "Compile the current region in the inferior Lisp process." 351 "Compile the current region in the inferior Lisp process.
300 (interactive "r") 352Prefix argument means switch-to-lisp afterwards."
353 (interactive "r\nP")
301 (comint-send-string (cmulisp-proc) 354 (comint-send-string (cmulisp-proc)
302 (format "(funcall (compile nil `(lambda () (progn 'compile %s))))\n" 355 (format "(funcall (compile nil `(lambda () (progn 'compile %s))))\n"
303 (buffer-substring start end)))) 356 (buffer-substring start end)))
357 (if and-go (switch-to-lisp t)))
304 358
305(defun lisp-compile-defun () 359(defun lisp-compile-defun (&optional and-go)
306 "Compile the current defun in the inferior Lisp process." 360 "Compile the current defun in the inferior Lisp process.
307 (interactive) 361Prefix argument means switch-to-lisp afterwards."
362 (interactive "P")
308 (save-excursion 363 (save-excursion
309 (end-of-defun) 364 (end-of-defun)
365 (skip-chars-backward " \t\n\r\f") ; Makes allegro happy
310 (let ((e (point))) 366 (let ((e (point)))
311 (beginning-of-defun) 367 (beginning-of-defun)
312 (lisp-compile-region (point) e)))) 368 (lisp-compile-region (point) e)))
369 (if and-go (switch-to-lisp t)))
313 370
314(defun switch-to-lisp (eob-p) 371(defun switch-to-lisp (eob-p)
315 "Switch to the inferior Lisp process buffer. 372 "Switch to the inferior Lisp process buffer.
@@ -322,33 +379,35 @@ With argument, positions cursor at end of buffer."
322 (push-mark) 379 (push-mark)
323 (goto-char (point-max))))) 380 (goto-char (point-max)))))
324 381
382
383;;; Now that lisp-compile/eval-defun/region takes an optional prefix arg,
384;;; these commands are redundant. But they are kept around for the user
385;;; to bind if he wishes, for backwards functionality, and because it's
386;;; easier to type C-c e than C-u C-c C-e.
387
325(defun lisp-eval-region-and-go (start end) 388(defun lisp-eval-region-and-go (start end)
326 "Send the current region to the inferior Lisp, 389 "Send the current region to the inferior Lisp,
327and switch to the process buffer." 390and switch to the process buffer."
328 (interactive "r") 391 (interactive "r")
329 (lisp-eval-region start end) 392 (lisp-eval-region start end t))
330 (switch-to-lisp t))
331 393
332(defun lisp-eval-defun-and-go () 394(defun lisp-eval-defun-and-go ()
333 "Send the current defun to the inferior Lisp, 395 "Send the current defun to the inferior Lisp,
334and switch to the process buffer." 396and switch to the process buffer."
335 (interactive) 397 (interactive)
336 (lisp-eval-defun) 398 (lisp-eval-defun t))
337 (switch-to-lisp t))
338 399
339(defun lisp-compile-region-and-go (start end) 400(defun lisp-compile-region-and-go (start end)
340 "Compile the current region in the inferior Lisp, 401 "Compile the current region in the inferior Lisp,
341and switch to the process buffer." 402and switch to the process buffer."
342 (interactive "r") 403 (interactive "r")
343 (lisp-compile-region start end) 404 (lisp-compile-region start end t))
344 (switch-to-lisp t))
345 405
346(defun lisp-compile-defun-and-go () 406(defun lisp-compile-defun-and-go ()
347 "Compile the current defun in the inferior Lisp, 407 "Compile the current defun in the inferior Lisp,
348and switch to the process buffer." 408and switch to the process buffer."
349 (interactive) 409 (interactive)
350 (lisp-compile-defun) 410 (lisp-compile-defun t))
351 (switch-to-lisp t))
352 411
353;;; A version of the form in H. Shevis' soar-mode.el package. Less robust. 412;;; A version of the form in H. Shevis' soar-mode.el package. Less robust.
354;(defun lisp-compile-sexp (start end) 413;(defun lisp-compile-sexp (start end)
@@ -406,7 +465,8 @@ Used by these commands to determine defaults.")
406 (setq lisp-prev-l/c-dir/file (cons (file-name-directory file-name) 465 (setq lisp-prev-l/c-dir/file (cons (file-name-directory file-name)
407 (file-name-nondirectory file-name))) 466 (file-name-nondirectory file-name)))
408 (comint-send-string (cmulisp-proc) 467 (comint-send-string (cmulisp-proc)
409 (format inferior-lisp-load-command file-name))) 468 (format inferior-lisp-load-command file-name))
469 (switch-to-lisp t))
410 470
411 471
412(defun lisp-compile-file (file-name) 472(defun lisp-compile-file (file-name)
@@ -419,7 +479,8 @@ Used by these commands to determine defaults.")
419 (file-name-nondirectory file-name))) 479 (file-name-nondirectory file-name)))
420 (comint-send-string (cmulisp-proc) (concat "(compile-file \"" 480 (comint-send-string (cmulisp-proc) (concat "(compile-file \""
421 file-name 481 file-name
422 "\"\)\n"))) 482 "\"\)\n"))
483 (switch-to-lisp t))
423 484
424 485
425 486
@@ -541,7 +602,7 @@ have three inferior lisps running:
541 foo cmulisp 602 foo cmulisp
542 bar cmulisp<2> 603 bar cmulisp<2>
543 *cmulisp* cmulisp<3> 604 *cmulisp* cmulisp<3>
544If you do a \\[lisp-eval-defun-and-go] command on some Lisp source code, 605If you do a \\[lisp-eval-defun] command on some Lisp source code,
545what process do you send it to? 606what process do you send it to?
546 607
547- If you're in a process buffer (foo, bar, or *cmulisp*), 608- If you're in a process buffer (foo, bar, or *cmulisp*),
@@ -598,6 +659,25 @@ This is a good place to put keybindings.")
598;;; 3/12/90 Olin 659;;; 3/12/90 Olin
599;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp. 660;;; - lisp-load-file and lisp-compile-file no longer switch-to-lisp.
600;;; Tale suggested this. 661;;; Tale suggested this.
662;;; - Reversed this decision 7/15/91. You need the visual feedback.
663;;;
664;;; 7/25/91 Olin
665;;; Changed all keybindings of the form C-c <letter>. These are
666;;; supposed to be reserved for the user to bind. This affected
667;;; mainly the compile/eval-defun/region[-and-go] commands.
668;;; This was painful, but necessary to adhere to the gnumacs standard.
669;;; For some backwards compatibility, see the
670;;; cmulisp-install-letter-bindings
671;;; function.
672;;;
673;;; 8/2/91 Olin
674;;; - The lisp-compile/eval-defun/region commands now take a prefix arg,
675;;; which means switch-to-lisp after sending the text to the Lisp process.
676;;; This obsoletes all the -and-go commands. The -and-go commands are
677;;; kept around for historical reasons, and because the user can bind
678;;; them to key sequences shorter than C-u C-c C-<letter>.
679;;; - If M-x cmulisp is invoked with a prefix arg, it allows you to
680;;; edit the command line.
601 681
602(provide 'cmulisp) 682(provide 'cmulisp)
603 683
diff --git a/lisp/simple.el b/lisp/simple.el
index 8c555190de1..3989a3685a2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -724,7 +724,14 @@ text that other programs have provided for pasting.
724The function should be called with no arguments. If the function 724The function should be called with no arguments. If the function
725returns nil, then no other program has provided such text, and the top 725returns nil, then no other program has provided such text, and the top
726of the Emacs kill ring should be used. If the function returns a 726of the Emacs kill ring should be used. If the function returns a
727string, that string should be put in the kill ring as the latest kill.") 727string, that string should be put in the kill ring as the latest kill.
728
729Note that the function should return a string only if a program other
730than Emacs has provided a string for pasting; if Emacs provided the
731most recent string, the function should return nil. If it is
732difficult to tell whether Emacs or some other program provided the
733current string, it is probably good enough to return nil if the string
734is equal (according to `string=') to the last text Emacs provided.")
728 735
729 736
730 737
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 3f6cefe0a6f..22237e5e21a 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -447,6 +447,11 @@ This returns ARGS with the arguments that have been processed removed."
447 '(lambda () 447 '(lambda ()
448 (error "Suspending an emacs running under X makes no sense"))) 448 (error "Suspending an emacs running under X makes no sense")))
449 449
450;;; We keep track of the last text selected here, so we can check the
451;;; current selection against it, and avoid passing back our own text
452;;; from x-cut-buffer-or-selection-value.
453(defvar x-last-selected-text nil)
454
450;;; Make TEXT, a string, the primary and clipboard X selections. 455;;; Make TEXT, a string, the primary and clipboard X selections.
451;;; If you are running xclipboard, this means you can effectively 456;;; If you are running xclipboard, this means you can effectively
452;;; have a window on a copy of the kill-ring. 457;;; have a window on a copy of the kill-ring.
@@ -455,14 +460,19 @@ This returns ARGS with the arguments that have been processed removed."
455(defun x-select-text (text) 460(defun x-select-text (text)
456 (x-own-selection text 'cut-buffer0) 461 (x-own-selection text 'cut-buffer0)
457 (x-own-selection text 'clipboard) 462 (x-own-selection text 'clipboard)
458 (x-own-selection text)) 463 (x-own-selection text)
464 (setq x-last-selected-text text))
459 465
460;;; Return the value of the current X selection. For compatibility 466;;; Return the value of the current X selection. For compatibility
461;;; with older X applications, this checks cut buffer 0 before 467;;; with older X applications, this checks cut buffer 0 before
462;;; retrieving the value of the primary selection. 468;;; retrieving the value of the primary selection.
463(defun x-cut-buffer-or-selection-value () 469(defun x-cut-buffer-or-selection-value ()
464 (or (x-selection-value 'cut-buffer0) 470 (let ((text (or (x-selection-value 'cut-buffer0)
465 (x-selection-value))) 471 (x-selection-value))))
472 (if (string= text x-last-selected-text)
473 nil
474 (setq x-last-selected-text nil)
475 text)))
466 476
467;;; Arrange for the kill and yank functions to set and check the clipboard. 477;;; Arrange for the kill and yank functions to set and check the clipboard.
468(setq interprogram-cut-function 'x-select-text) 478(setq interprogram-cut-function 'x-select-text)
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 56a4ab59c59..a87d2b09251 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -1,12 +1,12 @@
1;;; text-mode.el --- text mode, and its idiosyncratic commands. 1;;; text-mode.el --- text mode, and its idiosyncratic commands.
2 2
3;; Copyright (C) 1985 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1992 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 7;; GNU Emacs is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 1, or (at your option) 9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version. 10;; any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
@@ -94,18 +94,6 @@ if that value is non-nil."
94 (setq major-mode 'indented-text-mode) 94 (setq major-mode 'indented-text-mode)
95 (run-hooks 'text-mode-hook)) 95 (run-hooks 'text-mode-hook))
96 96
97(defun change-log-mode ()
98 "Major mode for editing ChangeLog files. See M-x add-change-log-entry.
99Almost the same as Indented Text mode, but prevents numeric backups
100and sets `left-margin' to 8 and `fill-column' to 74."
101 (interactive)
102 (indented-text-mode)
103 (setq left-margin 8)
104 (setq fill-column 74)
105 (make-local-variable 'version-control)
106 (setq version-control 'never)
107 (run-hooks 'change-log-mode-hook))
108
109(defun center-paragraph () 97(defun center-paragraph ()
110 "Center each nonblank line in the paragraph at or after point. 98 "Center each nonblank line in the paragraph at or after point.
111See center-line for more info." 99See center-line for more info."
diff --git a/src/.gdbinit b/src/.gdbinit
index 91a921119e8..fd470e31384 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -32,9 +32,12 @@ end
32 32
33define xwindow 33define xwindow
34print (struct window *) ($ & 0x00ffffff) 34print (struct window *) ($ & 0x00ffffff)
35print ($->left)@4
36print $$
35end 37end
36document xwindow 38document xwindow
37Print $ as a window pointer, assuming it is an Elisp window value. 39Print $ as a window pointer, assuming it is an Elisp window value.
40Print the window's position as { left, top, height, width }.
38end 41end
39 42
40define xmarker 43define xmarker
@@ -46,9 +49,12 @@ end
46 49
47define xbuffer 50define xbuffer
48print (struct buffer *) ($ & 0x00ffffff) 51print (struct buffer *) ($ & 0x00ffffff)
52print &((struct Lisp_String *) (($->name) & 0x00ffffff))->data
53print $$
49end 54end
50document xbuffer 55document xbuffer
51Print $ as a buffer pointer, assuming it is an Elisp buffer value. 56Set $ as a buffer pointer, assuming it is an Elisp buffer value.
57Print the name of the buffer.
52end 58end
53 59
54define xsymbol 60define xsymbol
diff --git a/src/alloc.c b/src/alloc.c
index 9c63f8fe132..c0d92e33802 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -960,7 +960,7 @@ Does not copy symbols.")
960 960
961struct gcpro *gcprolist; 961struct gcpro *gcprolist;
962 962
963#define NSTATICS 256 963#define NSTATICS 512
964 964
965Lisp_Object *staticvec[NSTATICS] = {0}; 965Lisp_Object *staticvec[NSTATICS] = {0};
966 966
diff --git a/src/eval.c b/src/eval.c
index d3d475f4d10..0e012d45008 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -41,8 +41,9 @@ struct backtrace
41 struct backtrace *next; 41 struct backtrace *next;
42 Lisp_Object *function; 42 Lisp_Object *function;
43 Lisp_Object *args; /* Points to vector of args. */ 43 Lisp_Object *args; /* Points to vector of args. */
44 int nargs; /* length of vector */ 44 int nargs; /* Length of vector.
45 /* if nargs is UNEVALLED, args points to slot holding list of unevalled args */ 45 If nargs is UNEVALLED, args points to slot holding
46 list of unevalled args */
46 char evalargs; 47 char evalargs;
47 /* Nonzero means call value of debugger when done with this operation. */ 48 /* Nonzero means call value of debugger when done with this operation. */
48 char debug_on_exit; 49 char debug_on_exit;
@@ -451,20 +452,33 @@ and input is currently coming from the keyboard (not in keyboard macro).")
451 if (!INTERACTIVE) 452 if (!INTERACTIVE)
452 return Qnil; 453 return Qnil;
453 454
454 /* Unless the object was compiled, skip the frame of interactive-p itself
455 (if interpreted) or the frame of byte-code (if called from
456 compiled function). */
457 btp = backtrace_list; 455 btp = backtrace_list;
458 if (XTYPE (*btp->function) != Lisp_Compiled) 456
457 /* If this isn't a byte-compiled function, there may be a frame at
458 the top for Finteractive_p itself. If so, skip it. */
459 fun = Findirect_function (*btp->function);
460 if (XTYPE (fun) == Lisp_Subr
461 && (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p)
459 btp = btp->next; 462 btp = btp->next;
460 while (btp 463
461 && (btp->nargs == UNEVALLED || EQ (*btp->function, Qbytecode))) 464 /* If we're running an Emacs 18-style byte-compiled function, there
465 may be a frame for Fbytecode. Now, given the strictest
466 definition, this function isn't really being called
467 interactively, but because that's the way Emacs 18 always builds
468 byte-compiled functions, we'll accept it for now. */
469 if (EQ (*btp->function, Qbytecode))
470 btp = btp->next;
471
472 /* If this isn't a byte-compiled function, then we may now be
473 looking at several frames for special forms. Skip past them. */
474 while (btp &&
475 btp->nargs == UNEVALLED)
462 btp = btp->next; 476 btp = btp->next;
463 477
464 /* btp now points at the frame of the innermost function 478 /* btp now points at the frame of the innermost function that isn't
465 that DOES eval its args. 479 a special form, ignoring frames for Finteractive_p and/or
466 If it is a built-in function (such as load or eval-region) 480 Fbytecode at the top. If this frame is for a built-in function
467 return nil. */ 481 (such as load or eval-region) return nil. */
468 fun = Findirect_function (*btp->function); 482 fun = Findirect_function (*btp->function);
469 if (XTYPE (fun) == Lisp_Subr) 483 if (XTYPE (fun) == Lisp_Subr)
470 return Qnil; 484 return Qnil;
@@ -2320,8 +2334,8 @@ See also variable `debug-on-quit'.");
2320 2334
2321 DEFVAR_BOOL ("debug-on-quit", &debug_on_quit, 2335 DEFVAR_BOOL ("debug-on-quit", &debug_on_quit,
2322 "*Non-nil means enter debugger if quit is signaled (C-G, for example).\n\ 2336 "*Non-nil means enter debugger if quit is signaled (C-G, for example).\n\
2323Does not apply if quit is handled by a `condition-case'. 2337Does not apply if quit is handled by a `condition-case'.\n\
2324A non-nil value is equivalent to a `debug-on-error' value containing 'quit."); 2338A non-nil value is equivalent to a `debug-on-error' value containing `quit'.");
2325 debug_on_quit = 0; 2339 debug_on_quit = 0;
2326 2340
2327 DEFVAR_BOOL ("debug-on-next-call", &debug_on_next_call, 2341 DEFVAR_BOOL ("debug-on-next-call", &debug_on_next_call,
diff --git a/src/fns.c b/src/fns.c
index 8562f142dce..b30a2422f7f 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -20,41 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 20
21#include "config.h" 21#include "config.h"
22 22
23#ifdef LOAD_AVE_TYPE
24#ifdef BSD
25/* It appears param.h defines BSD and BSD4_3 in 4.3
26 and is not considerate enough to avoid bombing out
27 if they are already defined. */
28#undef BSD
29#ifdef BSD4_3
30#undef BSD4_3
31#define XBSD4_3 /* XBSD4_3 says BSD4_3 is supposed to be defined. */
32#endif
33#include <sys/param.h>
34/* Now if BSD or BSD4_3 was defined and is no longer,
35 define it again. */
36#ifndef BSD
37#define BSD
38#endif
39#ifdef XBSD4_3
40#ifndef BSD4_3
41#define BSD4_3
42#endif
43#endif /* XBSD4_3 */
44#endif /* BSD */
45#ifndef VMS
46#ifndef NLIST_STRUCT
47#include <a.out.h>
48#else /* NLIST_STRUCT */
49#include <nlist.h>
50#endif /* NLIST_STRUCT */
51#endif /* not VMS */
52#endif /* LOAD_AVE_TYPE */
53
54#ifdef DGUX
55#include <sys/dg_sys_info.h> /* for load average info - DJB */
56#endif
57
58/* Note on some machines this defines `vector' as a typedef, 23/* Note on some machines this defines `vector' as a typedef,
59 so make sure we don't use that name in this file. */ 24 so make sure we don't use that name in this file. */
60#undef vector 25#undef vector
@@ -1226,171 +1191,27 @@ and can rub it out if not confirmed.")
1226 UNGCPRO; 1191 UNGCPRO;
1227} 1192}
1228 1193
1229/* Avoid static vars inside a function since in HPUX they dump as pure. */
1230#ifdef DGUX
1231static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
1232
1233#else /* Not DGUX */
1234
1235static int ldav_initialized;
1236static int ldav_channel;
1237#ifdef LOAD_AVE_TYPE
1238#ifndef VMS
1239static struct nlist ldav_nl[2];
1240#endif /* VMS */
1241#endif /* LOAD_AVE_TYPE */
1242
1243#define channel ldav_channel
1244#define initialized ldav_initialized
1245#define nl ldav_nl
1246#endif /* Not DGUX */
1247
1248DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0, 1194DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0,
1249 "Return list of 1 minute, 5 minute and 15 minute load averages.\n\ 1195 "Return list of 1 minute, 5 minute and 15 minute load averages.\n\
1250Each of the three load averages is multiplied by 100,\n\ 1196Each of the three load averages is multiplied by 100,\n\
1251then converted to integer.") 1197then converted to integer.\n\
1198If the 5-minute or 15-minute load averages are not available, return a\n\
1199shortened list, containing only those averages which are available.")
1252 () 1200 ()
1253{ 1201{
1254#ifdef DGUX 1202 double load_ave[3];
1255 /* perhaps there should be a "sys_load_avg" call in sysdep.c?! - DJB */ 1203 int loads = getloadavg (load_ave, 3);
1256 load_info.one_minute = 0.0; /* just in case there is an error */ 1204 Lisp_Object ret;
1257 load_info.five_minute = 0.0;
1258 load_info.fifteen_minute = 0.0;
1259 dg_sys_info (&load_info, DG_SYS_INFO_LOAD_INFO_TYPE,
1260 DG_SYS_INFO_LOAD_VERSION_0);
1261
1262 return Fcons (make_number ((int)(load_info.one_minute * 100.0)),
1263 Fcons (make_number ((int)(load_info.five_minute * 100.0)),
1264 Fcons (make_number ((int)(load_info.fifteen_minute * 100.0)),
1265 Qnil)));
1266#else /* not DGUX */
1267#ifndef LOAD_AVE_TYPE
1268 error ("load-average not implemented for this operating system");
1269
1270#else /* LOAD_AVE_TYPE defined */
1271
1272 LOAD_AVE_TYPE load_ave[3];
1273#ifdef VMS
1274#ifndef eunice
1275#include <iodef.h>
1276#include <descrip.h>
1277#else
1278#include <vms/iodef.h>
1279 struct {int dsc$w_length; char *dsc$a_pointer;} descriptor;
1280#endif /* eunice */
1281#endif /* VMS */
1282
1283 /* If this fails for any reason, we can return (0 0 0) */
1284 load_ave[0] = 0.0; load_ave[1] = 0.0; load_ave[2] = 0.0;
1285
1286#ifdef VMS
1287 /*
1288 * VMS specific code -- read from the Load Ave driver
1289 */
1290
1291 /*
1292 * Ensure that there is a channel open to the load ave device
1293 */
1294 if (initialized == 0)
1295 {
1296 /* Attempt to open the channel */
1297#ifdef eunice
1298 descriptor.size = 18;
1299 descriptor.ptr = "$$VMS_LOAD_AVERAGE";
1300#else
1301 $DESCRIPTOR(descriptor, "LAV0:");
1302#endif
1303 if (sys$assign (&descriptor, &channel, 0, 0) & 1)
1304 initialized = 1;
1305 }
1306 /*
1307 * Read the load average vector
1308 */
1309 if (initialized)
1310 {
1311 if (!(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
1312 load_ave, 12, 0, 0, 0, 0)
1313 & 1))
1314 {
1315 sys$dassgn (channel);
1316 initialized = 0;
1317 }
1318 }
1319#else /* not VMS */
1320 /*
1321 * 4.2BSD UNIX-specific code -- read _avenrun from /dev/kmem
1322 */
1323
1324 /*
1325 * Make sure we have the address of _avenrun
1326 */
1327 if (nl[0].n_value == 0)
1328 {
1329 /*
1330 * Get the address of _avenrun
1331 */
1332#ifndef NLIST_STRUCT
1333 strcpy (nl[0].n_name, LDAV_SYMBOL);
1334 nl[1].n_zeroes = 0;
1335#else /* NLIST_STRUCT */
1336#ifdef convex
1337 nl[0].n_un.n_name = LDAV_SYMBOL;
1338 nl[1].n_un.n_name = 0;
1339#else /* not convex */
1340 nl[0].n_name = LDAV_SYMBOL;
1341 nl[1].n_name = 0;
1342#endif /* not convex */
1343#endif /* NLIST_STRUCT */
1344
1345 nlist (KERNEL_FILE, nl);
1346
1347#ifdef FIXUP_KERNEL_SYMBOL_ADDR
1348 FIXUP_KERNEL_SYMBOL_ADDR (nl);
1349#endif /* FIXUP_KERNEL_SYMBOL_ADDR */
1350 }
1351 /*
1352 * Make sure we have /dev/kmem open
1353 */
1354 if (initialized == 0)
1355 {
1356 /*
1357 * Open /dev/kmem
1358 */
1359 channel = open ("/dev/kmem", 0);
1360 if (channel >= 0) initialized = 1;
1361 }
1362 /*
1363 * If we can, get the load ave values
1364 */
1365 if ((nl[0].n_value != 0) && (initialized != 0))
1366 {
1367 /*
1368 * Seek to the correct address
1369 */
1370 lseek (channel, (long) nl[0].n_value, 0);
1371 if (read (channel, load_ave, sizeof load_ave)
1372 != sizeof(load_ave))
1373 {
1374 close (channel);
1375 initialized = 0;
1376 }
1377 }
1378#endif /* not VMS */
1379
1380 /*
1381 * Return the list of load average values
1382 */
1383 return Fcons (make_number (LOAD_AVE_CVT (load_ave[0])),
1384 Fcons (make_number (LOAD_AVE_CVT (load_ave[1])),
1385 Fcons (make_number (LOAD_AVE_CVT (load_ave[2])),
1386 Qnil)));
1387#endif /* LOAD_AVE_TYPE */
1388#endif /* not DGUX */
1389}
1390 1205
1391#undef channel 1206 if (loads < 0)
1392#undef initialized 1207 error ("load-average not implemented for this operating system");
1393#undef nl 1208
1209 ret = Qnil;
1210 while (loads > 0)
1211 ret = Fcons (make_number ((int) (load_ave[--loads] * 100.0)), ret);
1212
1213 return ret;
1214}
1394 1215
1395Lisp_Object Vfeatures; 1216Lisp_Object Vfeatures;
1396 1217
diff --git a/src/keyboard.c b/src/keyboard.c
index 12d936ad0d8..97b98c98b98 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1491,7 +1491,7 @@ kbd_buffer_store_event (event)
1491 get returned to Emacs as an event, the next event read 1491 get returned to Emacs as an event, the next event read
1492 will set Vlast_event_screen again, so this is safe to do. */ 1492 will set Vlast_event_screen again, so this is safe to do. */
1493 extern SIGTYPE interrupt_signal (); 1493 extern SIGTYPE interrupt_signal ();
1494 XSET (Vlast_event_screen, Lisp_Screen, event->screen); 1494 Vlast_event_screen = SCREEN_FOCUS_SCREEN (event->screen);
1495 last_event_timestamp = event->timestamp; 1495 last_event_timestamp = event->timestamp;
1496 interrupt_signal (); 1496 interrupt_signal ();
1497 return; 1497 return;
@@ -1610,6 +1610,10 @@ kbd_buffer_get_event ()
1610 { 1610 {
1611 if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE) 1611 if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
1612 kbd_fetch_ptr = kbd_buffer; 1612 kbd_fetch_ptr = kbd_buffer;
1613 /* Do the redirection specified by the focus_screen
1614 member now, before we return this event. */
1615 kbd_fetch_ptr->screen =
1616 XSCREEN (SCREEN_FOCUS_SCREEN (kbd_fetch_ptr->screen));
1613 XSET (Vlast_event_screen, Lisp_Screen, kbd_fetch_ptr->screen); 1617 XSET (Vlast_event_screen, Lisp_Screen, kbd_fetch_ptr->screen);
1614 last_event_timestamp = kbd_fetch_ptr->timestamp; 1618 last_event_timestamp = kbd_fetch_ptr->timestamp;
1615 obj = make_lispy_event (kbd_fetch_ptr); 1619 obj = make_lispy_event (kbd_fetch_ptr);
@@ -2765,7 +2769,7 @@ typed while in this function is treated like any other character, and\n\
2765 GCPRO1 (keybuf[0]); 2769 GCPRO1 (keybuf[0]);
2766 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); 2770 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
2767 2771
2768 if (! NILP (continue_echo)) 2772 if (NILP (continue_echo))
2769 this_command_key_count = 0; 2773 this_command_key_count = 0;
2770 2774
2771 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), 2775 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
@@ -3050,7 +3054,7 @@ Actually, the value is nil only if we can be sure that no input is available.")
3050} 3054}
3051 3055
3052DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, 3056DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
3053 "Return a vector of last 100 events read from terminal.") 3057 "Return vector of last 100 chars read from terminal.")
3054 () 3058 ()
3055{ 3059{
3056 Lisp_Object val; 3060 Lisp_Object val;
diff --git a/src/search.c b/src/search.c
index 88eb72ab1f4..5e2a96c87fa 100644
--- a/src/search.c
+++ b/src/search.c
@@ -59,9 +59,10 @@ Lisp_Object last_regexp;
59 able to free or re-allocate it properly. */ 59 able to free or re-allocate it properly. */
60static struct re_registers search_regs; 60static struct re_registers search_regs;
61 61
62/* Nonzero if search_regs are indices in a string; 0 if in a buffer. */ 62/* The buffer in which the last search was performed, or
63 63 Qt if the last search was done in a string;
64static int search_regs_from_string; 64 Qnil if no searching has been done yet. */
65static Lisp_Object last_thing_searched;
65 66
66/* error condition signalled when regexp compile_pattern fails */ 67/* error condition signalled when regexp compile_pattern fails */
67 68
@@ -178,7 +179,7 @@ data if you want to preserve them.")
178 search_regs.start[i] += BEGV; 179 search_regs.start[i] += BEGV;
179 search_regs.end[i] += BEGV; 180 search_regs.end[i] += BEGV;
180 } 181 }
181 search_regs_from_string = 0; 182 XSET (last_thing_searched, Lisp_Buffer, current_buffer);
182 immediate_quit = 0; 183 immediate_quit = 0;
183 return val; 184 return val;
184} 185}
@@ -219,7 +220,7 @@ matched by parenthesis constructs in the pattern.")
219 XSTRING (string)->size, s, XSTRING (string)->size - s, 220 XSTRING (string)->size, s, XSTRING (string)->size - s,
220 &search_regs); 221 &search_regs);
221 immediate_quit = 0; 222 immediate_quit = 0;
222 search_regs_from_string = 1; 223 last_thing_searched = Qt;
223 if (val == -2) 224 if (val == -2)
224 matcher_overflow (); 225 matcher_overflow ();
225 if (val < 0) return Qnil; 226 if (val < 0) return Qnil;
@@ -587,7 +588,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
587 search_regs.start[i] += j; 588 search_regs.start[i] += j;
588 search_regs.end[i] += j; 589 search_regs.end[i] += j;
589 } 590 }
590 search_regs_from_string = 0; 591 XSET (last_thing_searched, Lisp_Buffer, current_buffer);
591 /* Set pos to the new position. */ 592 /* Set pos to the new position. */
592 pos = search_regs.start[0]; 593 pos = search_regs.start[0];
593 } 594 }
@@ -614,7 +615,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
614 search_regs.start[i] += j; 615 search_regs.start[i] += j;
615 search_regs.end[i] += j; 616 search_regs.end[i] += j;
616 } 617 }
617 search_regs_from_string = 0; 618 XSET (last_thing_searched, Lisp_Buffer, current_buffer);
618 pos = search_regs.end[0]; 619 pos = search_regs.end[0];
619 } 620 }
620 else 621 else
@@ -804,7 +805,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
804 = pos + cursor - p2 + ((direction > 0) 805 = pos + cursor - p2 + ((direction > 0)
805 ? 1 - len : 0); 806 ? 1 - len : 0);
806 search_regs.end[0] = len + search_regs.start[0]; 807 search_regs.end[0] = len + search_regs.start[0];
807 search_regs_from_string = 0; 808 XSET (last_thing_searched, Lisp_Buffer, current_buffer);
808 if ((n -= direction) != 0) 809 if ((n -= direction) != 0)
809 cursor += dirlen; /* to resume search */ 810 cursor += dirlen; /* to resume search */
810 else 811 else
@@ -878,7 +879,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
878 search_regs.start[0] 879 search_regs.start[0]
879 = pos + ((direction > 0) ? 1 - len : 0); 880 = pos + ((direction > 0) ? 1 - len : 0);
880 search_regs.end[0] = len + search_regs.start[0]; 881 search_regs.end[0] = len + search_regs.start[0];
881 search_regs_from_string = 0; 882 XSET (last_thing_searched, Lisp_Buffer, current_buffer);
882 if ((n -= direction) != 0) 883 if ((n -= direction) != 0)
883 pos += dirlen; /* to resume search */ 884 pos += dirlen; /* to resume search */
884 else 885 else
@@ -1221,6 +1222,9 @@ Use `store-match-data' to reinstate the data in this list.")
1221 Lisp_Object *data; 1222 Lisp_Object *data;
1222 int i, len; 1223 int i, len;
1223 1224
1225 if (NILP (last_thing_searched))
1226 error ("match-data called before any match found");
1227
1224 data = (Lisp_Object *) alloca ((2 * search_regs.num_regs) 1228 data = (Lisp_Object *) alloca ((2 * search_regs.num_regs)
1225 * sizeof (Lisp_Object)); 1229 * sizeof (Lisp_Object));
1226 1230
@@ -1230,19 +1234,26 @@ Use `store-match-data' to reinstate the data in this list.")
1230 int start = search_regs.start[i]; 1234 int start = search_regs.start[i];
1231 if (start >= 0) 1235 if (start >= 0)
1232 { 1236 {
1233 if (search_regs_from_string) 1237 if (EQ (last_thing_searched, Qt))
1234 { 1238 {
1235 XFASTINT (data[2 * i]) = start; 1239 XFASTINT (data[2 * i]) = start;
1236 XFASTINT (data[2 * i + 1]) = search_regs.end[i]; 1240 XFASTINT (data[2 * i + 1]) = search_regs.end[i];
1237 } 1241 }
1238 else 1242 else if (XTYPE (last_thing_searched) == Lisp_Buffer)
1239 { 1243 {
1240 data[2 * i] = Fmake_marker (); 1244 data[2 * i] = Fmake_marker ();
1241 Fset_marker (data[2 * i], make_number (start), Qnil); 1245 Fset_marker (data[2 * i],
1246 make_number (start),
1247 last_thing_searched);
1242 data[2 * i + 1] = Fmake_marker (); 1248 data[2 * i + 1] = Fmake_marker ();
1243 Fset_marker (data[2 * i + 1], 1249 Fset_marker (data[2 * i + 1],
1244 make_number (search_regs.end[i]), Qnil); 1250 make_number (search_regs.end[i]),
1251 last_thing_searched);
1245 } 1252 }
1253 else
1254 /* last_thing_searched must always be Qt, a buffer, or Qnil. */
1255 abort ();
1256
1246 len = i; 1257 len = i;
1247 } 1258 }
1248 else 1259 else
@@ -1264,6 +1275,10 @@ LIST should have been created by calling `match-data' previously.")
1264 if (!CONSP (list) && !NILP (list)) 1275 if (!CONSP (list) && !NILP (list))
1265 list = wrong_type_argument (Qconsp, list, 0); 1276 list = wrong_type_argument (Qconsp, list, 0);
1266 1277
1278 /* Unless we find a marker with a buffer in LIST, assume that this
1279 match data came from a string. */
1280 last_thing_searched = Qt;
1281
1267 /* Allocate registers if they don't already exist. */ 1282 /* Allocate registers if they don't already exist. */
1268 { 1283 {
1269 int length = Flength (list) / 2; 1284 int length = Flength (list) / 2;
@@ -1302,9 +1317,14 @@ LIST should have been created by calling `match-data' previously.")
1302 } 1317 }
1303 else 1318 else
1304 { 1319 {
1305 if (XTYPE (marker) == Lisp_Marker 1320 if (XTYPE (marker) == Lisp_Marker)
1306 && XMARKER (marker)->buffer == 0) 1321 {
1307 XFASTINT (marker) = 0; 1322 if (XMARKER (marker)->buffer == 0)
1323 XFASTINT (marker) = 0;
1324 else
1325 XSET (last_thing_searched, Lisp_Buffer,
1326 XMARKER (marker)->buffer);
1327 }
1308 1328
1309 CHECK_NUMBER_COERCE_MARKER (marker, 0); 1329 CHECK_NUMBER_COERCE_MARKER (marker, 0);
1310 search_regs.start[i] = XINT (marker); 1330 search_regs.start[i] = XINT (marker);
@@ -1383,6 +1403,9 @@ syms_of_search ()
1383 last_regexp = Qnil; 1403 last_regexp = Qnil;
1384 staticpro (&last_regexp); 1404 staticpro (&last_regexp);
1385 1405
1406 last_thing_searched = Qnil;
1407 staticpro (&last_thing_searched);
1408
1386 defsubr (&Sstring_match); 1409 defsubr (&Sstring_match);
1387 defsubr (&Slooking_at); 1410 defsubr (&Slooking_at);
1388 defsubr (&Sskip_chars_forward); 1411 defsubr (&Sskip_chars_forward);
diff --git a/src/xdisp.c b/src/xdisp.c
index 2045f7f9f2c..60bdafea9d8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -311,6 +311,18 @@ echo_area_display ()
311 /* If desired cursor location is on this line, put it at end of text */ 311 /* If desired cursor location is on this line, put it at end of text */
312 if (SCREEN_CURSOR_Y (s) == vpos) 312 if (SCREEN_CURSOR_Y (s) == vpos)
313 SCREEN_CURSOR_X (s) = s->desired_glyphs->used[vpos]; 313 SCREEN_CURSOR_X (s) = s->desired_glyphs->used[vpos];
314
315 /* Fill the rest of the minibuffer window with blank lines. */
316 {
317 int i;
318
319 for (i = vpos + 1; i < vpos + XWINDOW (minibuf_window)->height; i++)
320 {
321 get_display_line (s, i, 0);
322 display_string (XWINDOW (minibuf_window), vpos,
323 "", 0, 0, 0, SCREEN_WIDTH (s));
324 }
325 }
314 } 326 }
315 else if (!EQ (minibuf_window, selected_window)) 327 else if (!EQ (minibuf_window, selected_window))
316 windows_or_buffers_changed++; 328 windows_or_buffers_changed++;
diff --git a/src/xfns.c b/src/xfns.c
index 6d32925f95b..6eb248c6baf 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1043,6 +1043,10 @@ x_set_name (s, arg, oldval)
1043{ 1043{
1044 CHECK_STRING (arg, 0); 1044 CHECK_STRING (arg, 0);
1045 1045
1046 /* Don't change the name if it's already ARG. */
1047 if (! NILP (Fstring_equal (arg, s->name)))
1048 return;
1049
1046 if (s->display.x->window_desc) 1050 if (s->display.x->window_desc)
1047 { 1051 {
1048#ifdef HAVE_X11 1052#ifdef HAVE_X11
@@ -1056,7 +1060,6 @@ x_set_name (s, arg, oldval)
1056 XSetWMIconName (XDISPLAY s->display.x->window_desc, &prop); 1060 XSetWMIconName (XDISPLAY s->display.x->window_desc, &prop);
1057 UNBLOCK_INPUT; 1061 UNBLOCK_INPUT;
1058#else 1062#else
1059 s->name = arg;
1060 BLOCK_INPUT; 1063 BLOCK_INPUT;
1061 XStoreName (XDISPLAY s->display.x->window_desc, 1064 XStoreName (XDISPLAY s->display.x->window_desc,
1062 (char *) XSTRING (arg)->data); 1065 (char *) XSTRING (arg)->data);
@@ -1065,6 +1068,8 @@ x_set_name (s, arg, oldval)
1065 UNBLOCK_INPUT; 1068 UNBLOCK_INPUT;
1066#endif 1069#endif
1067 } 1070 }
1071
1072 s->name = arg;
1068} 1073}
1069 1074
1070void 1075void
@@ -1868,8 +1873,9 @@ be shared by the new screen.")
1868 build_string ("white"), "background", string); 1873 build_string ("white"), "background", string);
1869 x_default_parameter (s, parms, "border-width", 1874 x_default_parameter (s, parms, "border-width",
1870 make_number (2), "BorderWidth", number); 1875 make_number (2), "BorderWidth", number);
1876 /* This defaults to 2 in order to match XTerms. */
1871 x_default_parameter (s, parms, "internal-border-width", 1877 x_default_parameter (s, parms, "internal-border-width",
1872 make_number (1), "InternalBorderWidth", number); 1878 make_number (2), "InternalBorderWidth", number);
1873 1879
1874 /* Also do the stuff which must be set before the window exists. */ 1880 /* Also do the stuff which must be set before the window exists. */
1875 x_default_parameter (s, parms, "foreground-color", 1881 x_default_parameter (s, parms, "foreground-color",
diff --git a/src/xterm.c b/src/xterm.c
index 7bf039a1cf1..194f8d6177a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1995,7 +1995,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
1995 { 1995 {
1996 bufp->kind = non_ascii_keystroke; 1996 bufp->kind = non_ascii_keystroke;
1997 XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff50); 1997 XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff50);
1998 bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); 1998 bufp->screen = s;
1999 bufp->modifiers = x_convert_modifiers (modifiers); 1999 bufp->modifiers = x_convert_modifiers (modifiers);
2000 bufp->timestamp = event.xkey.time; 2000 bufp->timestamp = event.xkey.time;
2001 bufp++; 2001 bufp++;
@@ -2012,7 +2012,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2012 *copy_buffer |= METABIT; 2012 *copy_buffer |= METABIT;
2013 bufp->kind = ascii_keystroke; 2013 bufp->kind = ascii_keystroke;
2014 XSET (bufp->code, Lisp_Int, *copy_buffer); 2014 XSET (bufp->code, Lisp_Int, *copy_buffer);
2015 bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); 2015 bufp->screen = s;
2016 bufp->timestamp = event.xkey.time; 2016 bufp->timestamp = event.xkey.time;
2017 bufp++; 2017 bufp++;
2018 } 2018 }
@@ -2021,7 +2021,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2021 { 2021 {
2022 bufp->kind = ascii_keystroke; 2022 bufp->kind = ascii_keystroke;
2023 XSET (bufp->code, Lisp_Int, copy_buffer[i]); 2023 XSET (bufp->code, Lisp_Int, copy_buffer[i]);
2024 bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); 2024 bufp->screen = s;
2025 bufp->timestamp = event.xkey.time; 2025 bufp->timestamp = event.xkey.time;
2026 bufp++; 2026 bufp++;
2027 } 2027 }
@@ -2071,7 +2071,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2071 bufp->kind = ascii_keystroke; 2071 bufp->kind = ascii_keystroke;
2072 XSET (bufp->code, Lisp_Int, where_mapping[i]); 2072 XSET (bufp->code, Lisp_Int, where_mapping[i]);
2073 XSET (bufp->time, Lisp_Int, event.xkey.time); 2073 XSET (bufp->time, Lisp_Int, event.xkey.time);
2074 bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); 2074 bufp->screen = s;
2075 bufp++; 2075 bufp++;
2076 } 2076 }
2077 count += nbytes; 2077 count += nbytes;
@@ -2308,13 +2308,13 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2308 { 2308 {
2309 bufp->kind = ascii_keystroke; 2309 bufp->kind = ascii_keystroke;
2310 bufp->code = (char) 'X' & 037; /* C-x */ 2310 bufp->code = (char) 'X' & 037; /* C-x */
2311 bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); 2311 bufp->screen = s;
2312 XSET (bufp->time, Lisp_Int, event.xkey.time); 2312 XSET (bufp->time, Lisp_Int, event.xkey.time);
2313 bufp++; 2313 bufp++;
2314 2314
2315 bufp->kind = ascii_keystroke; 2315 bufp->kind = ascii_keystroke;
2316 bufp->code = (char) 0; /* C-@ */ 2316 bufp->code = (char) 0; /* C-@ */
2317 bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); 2317 bufp->screen = s;
2318 XSET (bufp->time, Lisp_Int, event.xkey.time); 2318 XSET (bufp->time, Lisp_Int, event.xkey.time);
2319 bufp++; 2319 bufp++;
2320 2320
@@ -3606,6 +3606,9 @@ x_wm_set_size_hint (s, prompting)
3606 Window window = s->display.x->window_desc; 3606 Window window = s->display.x->window_desc;
3607 3607
3608 size_hints.flags = PResizeInc | PMinSize | PMaxSize; 3608 size_hints.flags = PResizeInc | PMinSize | PMaxSize;
3609#ifdef PBaseSize
3610 size_hints.flags |= PBaseSize;
3611#endif
3609 3612
3610 flexlines = s->height; 3613 flexlines = s->height;
3611 3614