aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/gdb-mi.el30
-rw-r--r--lisp/progmodes/gud.el9
-rw-r--r--lisp/progmodes/octave-inf.el7
-rw-r--r--lisp/progmodes/prolog.el6
-rw-r--r--lisp/progmodes/xscheme.el39
5 files changed, 40 insertions, 51 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index f5e1abdd546..8e15ec6584e 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -574,21 +574,20 @@ NOARG must be t when this macro is used outside `gud-def'"
574 (concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2) 574 (concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2)
575 ,(when (not noarg) 'arg))) 575 ,(when (not noarg) 'arg)))
576 576
577(defun gdb--check-interpreter (proc string) 577(defun gdb--check-interpreter (filter proc string)
578 (unless (zerop (length string)) 578 (unless (zerop (length string))
579 (let ((filter (process-get proc 'gud-normal-filter))) 579 (remove-function (process-filter proc) #'gdb--check-interpreter)
580 (set-process-filter proc filter) 580 (unless (memq (aref string 0) '(?^ ?~ ?@ ?& ?* ?=))
581 (unless (memq (aref string 0) '(?^ ?~ ?@ ?& ?* ?=)) 581 ;; Apparently we're not running with -i=mi.
582 ;; Apparently we're not running with -i=mi. 582 (let ((msg "Error: you did not specify -i=mi on GDB's command line!"))
583 (let ((msg "Error: you did not specify -i=mi on GDB's command line!")) 583 (message msg)
584 (message msg) 584 (setq string (concat (propertize msg 'font-lock-face 'error)
585 (setq string (concat (propertize msg 'font-lock-face 'error) 585 "\n" string)))
586 "\n" string))) 586 ;; Use the old gud-gbd filter, not because it works, but because it
587 ;; Use the old gud-gbd filter, not because it works, but because it 587 ;; will properly display GDB's answers rather than hanging waiting for
588 ;; will properly display GDB's answers rather than hanging waiting for 588 ;; answers that aren't coming.
589 ;; answers that aren't coming. 589 (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter))
590 (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter)) 590 (funcall filter proc string)))
591 (funcall filter proc string))))
592 591
593(defvar gdb-control-level 0) 592(defvar gdb-control-level 0)
594 593
@@ -662,8 +661,7 @@ detailed description of this mode.
662 ;; Setup a temporary process filter to warn when GDB was not started 661 ;; Setup a temporary process filter to warn when GDB was not started
663 ;; with -i=mi. 662 ;; with -i=mi.
664 (let ((proc (get-buffer-process gud-comint-buffer))) 663 (let ((proc (get-buffer-process gud-comint-buffer)))
665 (process-put proc 'gud-normal-filter (process-filter proc)) 664 (add-function :around (process-filter proc) #'gdb--check-interpreter))
666 (set-process-filter proc #'gdb--check-interpreter))
667 665
668 (set (make-local-variable 'gud-minor-mode) 'gdbmi) 666 (set (make-local-variable 'gud-minor-mode) 'gdbmi)
669 (set (make-local-variable 'gdb-control-level) 0) 667 (set (make-local-variable 'gdb-control-level) 0)
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 4e31c5e827c..6076f88dea6 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -3387,9 +3387,6 @@ ACTIVATEP non-nil means activate mouse motion events."
3387 3387
3388;;; Tips for `gud' 3388;;; Tips for `gud'
3389 3389
3390(defvar gud-tooltip-original-filter nil
3391 "Process filter to restore after GUD output has been received.")
3392
3393(defvar gud-tooltip-dereference nil 3390(defvar gud-tooltip-dereference nil
3394 "Non-nil means print expressions with a `*' in front of them. 3391 "Non-nil means print expressions with a `*' in front of them.
3395For C this would dereference a pointer expression.") 3392For C this would dereference a pointer expression.")
@@ -3423,7 +3420,7 @@ With arg, dereference expr if ARG is positive, otherwise do not dereference."
3423; gdb-mi.el gets round this problem. 3420; gdb-mi.el gets round this problem.
3424(defun gud-tooltip-process-output (process output) 3421(defun gud-tooltip-process-output (process output)
3425 "Process debugger output and show it in a tooltip window." 3422 "Process debugger output and show it in a tooltip window."
3426 (set-process-filter process gud-tooltip-original-filter) 3423 (remove-function (process-filter process) #'gud-tooltip-process-output)
3427 (tooltip-show (tooltip-strip-prompt process output) 3424 (tooltip-show (tooltip-strip-prompt process output)
3428 (or gud-tooltip-echo-area tooltip-use-echo-area))) 3425 (or gud-tooltip-echo-area tooltip-use-echo-area)))
3429 3426
@@ -3490,8 +3487,8 @@ so they have been disabled."))
3490 (gdb-input 3487 (gdb-input
3491 (concat cmd "\n") 3488 (concat cmd "\n")
3492 `(lambda () (gdb-tooltip-print ,expr)))) 3489 `(lambda () (gdb-tooltip-print ,expr))))
3493 (setq gud-tooltip-original-filter (process-filter process)) 3490 (add-function :override (process-filter process)
3494 (set-process-filter process 'gud-tooltip-process-output) 3491 #'gud-tooltip-process-output)
3495 (gud-basic-call cmd)) 3492 (gud-basic-call cmd))
3496 expr)))))))) 3493 expr))))))))
3497 3494
diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el
index de7ca32befe..4a227db7164 100644
--- a/lisp/progmodes/octave-inf.el
+++ b/lisp/progmodes/octave-inf.el
@@ -348,9 +348,9 @@ the rest to `inferior-octave-output-string'."
348The elements of LIST have to be strings and are sent one by one. All 348The elements of LIST have to be strings and are sent one by one. All
349output is passed to the filter `inferior-octave-output-digest'." 349output is passed to the filter `inferior-octave-output-digest'."
350 (let* ((proc inferior-octave-process) 350 (let* ((proc inferior-octave-process)
351 (filter (process-filter proc))
352 string) 351 string)
353 (set-process-filter proc 'inferior-octave-output-digest) 352 (add-function :override (process-filter proc)
353 #'inferior-octave-output-digest)
354 (setq inferior-octave-output-list nil) 354 (setq inferior-octave-output-list nil)
355 (unwind-protect 355 (unwind-protect
356 (while (setq string (car list)) 356 (while (setq string (car list))
@@ -360,7 +360,8 @@ output is passed to the filter `inferior-octave-output-digest'."
360 (while inferior-octave-receive-in-progress 360 (while inferior-octave-receive-in-progress
361 (accept-process-output proc)) 361 (accept-process-output proc))
362 (setq list (cdr list))) 362 (setq list (cdr list)))
363 (set-process-filter proc filter)))) 363 (remove-function (process-filter proc)
364 #'inferior-octave-output-digest))))
364 365
365(defun inferior-octave-directory-tracker (string) 366(defun inferior-octave-directory-tracker (string)
366 "Tracks `cd' commands issued to the inferior Octave process. 367 "Tracks `cd' commands issued to the inferior Octave process.
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 85e4172c8fe..8971e97a44e 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1770,7 +1770,8 @@ This function must be called from the source code buffer."
1770 real-file)) 1770 real-file))
1771 (with-current-buffer buffer 1771 (with-current-buffer buffer
1772 (goto-char (point-max)) 1772 (goto-char (point-max))
1773 (set-process-filter process 'prolog-consult-compile-filter) 1773 (add-function :override (process-filter process)
1774 #'prolog-consult-compile-filter)
1774 (process-send-string "prolog" command-string) 1775 (process-send-string "prolog" command-string)
1775 ;; (prolog-build-prolog-command compilep file real-file first-line)) 1776 ;; (prolog-build-prolog-command compilep file real-file first-line))
1776 (while (and prolog-process-flag 1777 (while (and prolog-process-flag
@@ -1781,7 +1782,8 @@ This function must be called from the source code buffer."
1781 (insert (if compilep 1782 (insert (if compilep
1782 "\nCompilation finished.\n" 1783 "\nCompilation finished.\n"
1783 "\nConsulted.\n")) 1784 "\nConsulted.\n"))
1784 (set-process-filter process old-filter)))) 1785 (remove-function (process-filter process)
1786 #'prolog-consult-compile-filter))))
1785 1787
1786(defvar compilation-error-list) 1788(defvar compilation-error-list)
1787 1789
diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el
index 2ad44b4b1c8..37c3cd37a6c 100644
--- a/lisp/progmodes/xscheme.el
+++ b/lisp/progmodes/xscheme.el
@@ -35,7 +35,6 @@
35;;;; Internal Variables 35;;;; Internal Variables
36 36
37(defvar xscheme-previous-mode) 37(defvar xscheme-previous-mode)
38(defvar xscheme-previous-process-state)
39(defvar xscheme-last-input-end) 38(defvar xscheme-last-input-end)
40 39
41(defvar xscheme-process-command-line nil 40(defvar xscheme-process-command-line nil
@@ -388,8 +387,6 @@ with no args, if that value is non-nil.
388 (if (not preserve) 387 (if (not preserve)
389 (let ((previous-mode major-mode)) 388 (let ((previous-mode major-mode))
390 (kill-all-local-variables) 389 (kill-all-local-variables)
391 (make-local-variable 'xscheme-process-name)
392 (make-local-variable 'xscheme-previous-process-state)
393 (make-local-variable 'xscheme-runlight-string) 390 (make-local-variable 'xscheme-runlight-string)
394 (make-local-variable 'xscheme-runlight) 391 (make-local-variable 'xscheme-runlight)
395 (set (make-local-variable 'xscheme-previous-mode) previous-mode) 392 (set (make-local-variable 'xscheme-previous-mode) previous-mode)
@@ -397,35 +394,29 @@ with no args, if that value is non-nil.
397 (set (make-local-variable 'xscheme-buffer-name) (buffer-name buffer)) 394 (set (make-local-variable 'xscheme-buffer-name) (buffer-name buffer))
398 (set (make-local-variable 'xscheme-last-input-end) (make-marker)) 395 (set (make-local-variable 'xscheme-last-input-end) (make-marker))
399 (let ((process (get-buffer-process buffer))) 396 (let ((process (get-buffer-process buffer)))
400 (if process 397 (when process
401 (progn 398 (setq-local xscheme-process-name (process-name process))
402 (setq xscheme-process-name (process-name process)) 399 ;; FIXME: Use add-function!
403 (setq xscheme-previous-process-state 400 (xscheme-process-filter-initialize t)
404 (cons (process-filter process) 401 (xscheme-mode-line-initialize xscheme-buffer-name)
405 (process-sentinel process))) 402 (add-function :override (process-sentinel process)
406 (xscheme-process-filter-initialize t) 403 #'xscheme-process-sentinel)
407 (xscheme-mode-line-initialize xscheme-buffer-name) 404 (add-function :override (process-filter process)
408 (set-process-sentinel process 'xscheme-process-sentinel) 405 #'xscheme-process-filter))))))
409 (set-process-filter process 'xscheme-process-filter))
410 (setq xscheme-previous-process-state (cons nil nil)))))))
411 (scheme-interaction-mode-initialize) 406 (scheme-interaction-mode-initialize)
412 (scheme-mode-variables) 407 (scheme-mode-variables)
413 (run-mode-hooks 'scheme-mode-hook 'scheme-interaction-mode-hook)) 408 (run-mode-hooks 'scheme-mode-hook 'scheme-interaction-mode-hook))
414 409
415(defun exit-scheme-interaction-mode () 410(defun exit-scheme-interaction-mode ()
416 "Take buffer out of scheme interaction mode" 411 "Take buffer out of scheme interaction mode."
417 (interactive) 412 (interactive)
418 (if (not (derived-mode-p 'scheme-interaction-mode)) 413 (if (not (derived-mode-p 'scheme-interaction-mode))
419 (error "Buffer not in scheme interaction mode")) 414 (error "Buffer not in scheme interaction mode"))
420 (let ((previous-state xscheme-previous-process-state)) 415 (funcall xscheme-previous-mode)
421 (funcall xscheme-previous-mode) 416 (let ((process (get-buffer-process (current-buffer))))
422 (let ((process (get-buffer-process (current-buffer)))) 417 (when process
423 (if process 418 (remove-function (process-sentinel process) #'xscheme-process-sentinel)
424 (progn 419 (remove-function (process-filter process) #'xscheme-process-filter))))
425 (if (eq (process-filter process) 'xscheme-process-filter)
426 (set-process-filter process (car previous-state)))
427 (if (eq (process-sentinel process) 'xscheme-process-sentinel)
428 (set-process-sentinel process (cdr previous-state))))))))
429 420
430(defvar scheme-interaction-mode-commands-alist nil) 421(defvar scheme-interaction-mode-commands-alist nil)
431(defvar scheme-interaction-mode-map nil) 422(defvar scheme-interaction-mode-map nil)