Misc. fixes
Hannu Koivisto <[email protected]>
| Newsgroups | gmane.lisp.ilisp.devel |
|---|---|
| Message-ID | <[email protected]> |
Greetings, comint-ipc change fixes the bug that caused point not to move after output after at least set-lisp-package command. Use of icon-type caused fatal problems with Emacs 21.1 running on W2k. I thought it would be better to remove its use completely for now until it is clear what versions are affected; it's not that important. More ECL prompt-regexp tuning. Since package names have no restrictions, the prompt can be almost anything. I'm not sure how general that regexp should be, i.e. would overly general regexp cause false matches. The current one probably works in practise. I'm not convinced that this regexp-stuff is a good approach to begin with, but use of Emacs 21's fields seems to be disabled and besides, something similar should be implemented for XEmacs. Not now. There was absolutely no sense in how lisp-pop-to-buffer worked in at least my KDE system (it stole focus in wrong situations, raised frames on top of everything else but didn't change focus, etc.) and in W2k, so I rewrote it. I believe it now works better in other systems as well. Note that the change only affects the case where lisp-no-popper is t (and switch-to-lisp). Other cases are broken as well, but since I don't use them, I couldn't find energy to fix them too. Perhaps later. 2002-02-15 Hannu Koivisto <[email protected]> * comint-ipc.el (comint-process-filter): Output handler is now called inside save-current-buffer instead of save-excursion so that if, for example, comint-insert is called by the handler, it is able to move the point. * ilisp-out.el (ilisp-make-output-frame): Disabled use of icon-type parameter with make-frame. * ilisp-kcl.el (ecl): comint-prompt-regexp tuned slightly. * ilisp-out.el * Removed old cruft in comments. * (lisp-pop-to-buffer): Rewritten to work sanely in all cases and to actually set input focus in Emacs 21 and XEmacs when requested with new optional set-input-focus-p parameter. * (switch-to-lisp): Now requests lisp-pop-to-buffer to set input focus. Also cosmetic changes. * (ilisp-display-output-in-lisp-listener): Cosmetic changes. -- Hannu Please don't send copies of list mail
ilisp-misc-fixes-20020215.diff
(text/x-patch, 7.5 KB)
Index: comint-ipc.el
===================================================================
RCS file: /home/azure/.cvs_root/ilisp/comint-ipc.el,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -U3 -r1.1.1.3 -r1.2
--- comint-ipc.el 2001/01/22 21:28:22 1.1.1.3
+++ comint-ipc.el 2002/02/15 16:37:58 1.2
@@ -478,7 +478,7 @@
;; The code hereafter fixes the problem.
(if handler
- (save-excursion
+ (save-current-buffer
(setq handler
(funcall handler comint-errorp wait-p
message output last))))
Index: ilisp-kcl.el
===================================================================
RCS file: /home/azure/.cvs_root/ilisp/ilisp-kcl.el,v
retrieving revision 1.1.1.8
retrieving revision 1.3
diff -U3 -r1.1.1.8 -r1.3
--- ilisp-kcl.el 2002/02/15 11:08:48 1.1.1.8
+++ ilisp-kcl.el 2002/02/14 23:58:32 1.3
@@ -119,7 +119,7 @@
;;; Currently maintained by Juan Jose Garcia-Ripoll
(defdialect ecl "EcoLisp Common LISP" akcl
- (setq comint-prompt-regexp "^>+ "
+ (setq comint-prompt-regexp "^\\([A-Z].*\\)?>+ "
ilisp-error-regexp "Broken at [^\n]*"
comint-fix-error ":pop\n(progn (terpri) (values))") ; kludge
Index: ilisp-out.el
===================================================================
RCS file: /home/azure/.cvs_root/ilisp/ilisp-out.el,v
retrieving revision 1.1.1.8
retrieving revision 1.6
diff -U3 -r1.1.1.8 -r1.6
--- ilisp-out.el 2001/06/22 22:39:00 1.1.1.8
+++ ilisp-out.el 2002/02/15 16:34:00 1.6
@@ -32,7 +32,10 @@
(visibility . nil)
(unsplittable . t)
(menu-bar-lines . 0)
- (icon-type . ,(ilisp-find-ilisp-icon))))))
+ ;; Use of icon-type is currently disabled due to a bug
+ ;; in at least Emacs 21.1 running on Windows.
+ ;; (icon-type . ,(ilisp-find-ilisp-icon))
+ ))))
(defvar ilisp-display-output-function 'ilisp-display-output-default
@@ -108,10 +111,6 @@
))
-;;; Useless
-;;; (push (cons t ilisp-output) ilisp-*command-to-ilisp-output-sink-table*)
-
-
;;; arglist-output
(defvar ilisp-arglist-output nil "Output sink for Arglist messages.")
@@ -177,15 +176,9 @@
ilisp-*command-to-ilisp-output-sink-table*)))
-;;; (push (cons 'arglist-lisp ilisp-arglist-output)
-;;; ilisp-*command-to-ilisp-output-sink-table*)
-
(ilisp-set-sink-for-command 'arglist-lisp
ilisp-arglist-output)
-;;; (push (cons 'ilisp-arglist-message-lisp-space ilisp-arglist-output)
-;;; ilisp-*command-to-ilisp-output-sink-table*)
-
(ilisp-set-sink-for-command 'ilisp-arglist-message-lisp-space
ilisp-arglist-output)
@@ -815,90 +808,48 @@
(setq ilisp-last-buffer buffer))
(comint-insert
(concat
- (if ilisp-last-message
- (concat ";;; " ilisp-last-message "\n"))
+ (when ilisp-last-message
+ (concat ";;; " ilisp-last-message "\n"))
(comint-remove-whitespace output)
"\n"
ilisp-last-prompt))
(setq ilisp-last-message nil))
(when (window-point window)
(select-window window)
- (set-buffer buffer))
- )))
+ (set-buffer buffer)))))
-
-;;; Changed according to suggestions by Robert P. Goldman
-(defun* lisp-pop-to-buffer (pbuffer &optional (ilisp-output-sink nil))
+(defun lisp-pop-to-buffer (pbuffer &optional ilisp-output-sink set-input-focus-p)
"Like pop-to-buffer, but select a screen that buffer was shown in.
ilisp-output-sink is the last ilisp-output-sink visited/active or nil
if this is not relevant."
(let* ((buffer (or pbuffer
(when ilisp-output-sink
(ilisp-output-sink-buffer ilisp-output-sink))))
- (ilisp-window (if ilisp-epoch-running
- (epoch::get-buffer-window buffer)
- (get-buffer-window buffer))))
- (if ilisp-window
- (select-window ilisp-window)
- ;; It is not currently displayed, so find some place to display
- ;; it.
- (progn
- (cond (ilisp-epoch-running
- ;; Select a screen that the buffer has been displayed in before
- ;; or the current screen otherwise.
- (epoch::select-screen
- ;; allowed-screens in epoch 3.2, was called screens before that
- (or (car (save-excursion
- (ignore-errors ; hack!
- (set-buffer buffer))
- (symbol-value 'allowed-screens)))
- (epoch::current-screen))))
-
- ;; Next clauses patterned after a suggestion by R. P. Goldman.
- ((or (eq +ilisp-emacs-version-id+ 'fsf-19)
- (eq +ilisp-emacs-version-id+ 'fsf-20))
- (let* ((window (get-buffer-window buffer t))
- (frame (if window (window-frame window))))
- (if (eq 'x (framep frame))
- (progn
- (raise-frame frame)
- (select-frame frame)))))
- (t nil)) ; fsf-18, but also lucid and
- ; xemacs.
- ; I do not know how to make
- ; them work
- ; Marco Antoniotti, Jan 4th 1995
- (if ilisp-output-sink
- (ilisp-bury-output ilisp-output-sink))
- (pop-to-buffer buffer)))
+ (window (if ilisp-epoch-running
+ (epoch::get-buffer-window buffer)
+ (get-buffer-window buffer t)))
+ (frame (when window (window-frame window))))
+ (cond ((not window)
+ (when ilisp-output-sink
+ (ilisp-bury-output ilisp-output-sink)) ; is this neccessary?
+ (pop-to-buffer buffer))
+ (set-input-focus-p
+ (if (fboundp 'select-frame-set-input-focus)
+ (select-frame-set-input-focus frame)
+ (raise-frame frame)
+ (select-frame frame)
+ (focus-frame frame))
+ (select-window window))
+ (t (when (or (memq (frame-visible-p frame) '(nil icon))
+ (when (fboundp 'frame-iconified-p)
+ (frame-iconified-p frame)))
+ (raise-frame frame)
+ (raise-frame (selected-frame)))
+ (select-frame frame)
+ (select-window window)))
(set-buffer buffer)))
-;(defun lisp-pop-to-buffer (buffer)
-; "Like pop-to-buffer, but select a screen that buffer was shown in.
-; Also, first bury any typeout-window."
-; (let ((ilisp-window (if ilisp-epoch-running
-; (epoch::get-buffer-window buffer)
-; (get-buffer-window buffer))))
-; (if ilisp-window
-; (select-window ilisp-window)
-; ;; It is not currently displayed, so find some place to display it.
-; (if ilisp-epoch-running
-; ;; Select a screen that the buffer has been displayed in before
-; ;; or the current screen otherwise.
-; (epoch::select-screen
-; ;; allowed-screens in epoch 3.2, was called screens before that
-; (or (car (save-excursion
-; (set-buffer buffer)
-; (symbol-value 'allowed-screens)))
-; (epoch::current-screen))))
-; ;; Do not pop to the output buffer.
-; (ilisp-bury-output)
-; (pop-to-buffer buffer)))
-; (set-buffer buffer))
-
-
-;;; switch-to-lisp
(defun switch-to-lisp (eob-p &optional ilisp-only)
"If in an ILISP buffer, switch to the last non-ILISP buffer visited.
@@ -908,10 +859,11 @@
(interactive "P")
(if (and (not ilisp-only) ilisp-last-buffer
(memq major-mode ilisp-modes))
- (lisp-pop-to-buffer ilisp-last-buffer)
- (if (not (memq major-mode ilisp-modes))
- (setq ilisp-last-buffer (current-buffer)))
- (lisp-pop-to-buffer (ilisp-buffer))
- (cond (eob-p (goto-char (point-max))))))
+ (lisp-pop-to-buffer ilisp-last-buffer nil t)
+ (unless (memq major-mode ilisp-modes)
+ (setq ilisp-last-buffer (current-buffer)))
+ (lisp-pop-to-buffer (ilisp-buffer) nil t)
+ (when eob-p
+ (goto-char (point-max)))))
;;; end of file -- ilisp-out.el --