diff options
| author | Stefan Monnier | 2006-09-07 16:18:06 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2006-09-07 16:18:06 +0000 |
| commit | 23f2d048b5df9fe9bfd39e8e1cd606e3bcd42c7c (patch) | |
| tree | a1813c3958973fac9c3e85be1402725c1e46aeb0 | |
| parent | dad2e044d30405f1403575ff7c892ea022541932 (diff) | |
| download | emacs-23f2d048b5df9fe9bfd39e8e1cd606e3bcd42c7c.tar.gz emacs-23f2d048b5df9fe9bfd39e8e1cd606e3bcd42c7c.zip | |
(inferior-prolog-flavor): New var left out of previous commit.
(inferior-prolog-guess-flavor): New fun left out of previous commit.
(prolog-consult-region-and-go): Don't hard code "*prolog*" and don't
burp in dedicated windows.
(inferior-prolog-self-insert-command): New command.
(inferior-prolog-mode-map): Use it.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/progmodes/prolog.el | 41 |
2 files changed, 50 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fde31fe5b21..7e50d886d56 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2006-09-07 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * progmodes/prolog.el (inferior-prolog-flavor): New var left out of | ||
| 4 | previous commit. | ||
| 5 | (inferior-prolog-guess-flavor): New fun left out of previous commit. | ||
| 6 | (prolog-consult-region-and-go): Don't hard code "*prolog*" and don't | ||
| 7 | burp in dedicated windows. | ||
| 8 | (inferior-prolog-self-insert-command): New command. | ||
| 9 | (inferior-prolog-mode-map): Use it. | ||
| 10 | |||
| 1 | 2006-09-07 Reiner Steib <Reiner.Steib@gmx.de> | 11 | 2006-09-07 Reiner Steib <Reiner.Steib@gmx.de> |
| 2 | 12 | ||
| 3 | * international/latexenc.el (latex-inputenc-coding-alist): Add cp858. | 13 | * international/latexenc.el (latex-inputenc-coding-alist): Add cp858. |
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 7bb8c3a3f40..c29a259c3a6 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el | |||
| @@ -233,6 +233,8 @@ rigidly along with this one (not yet)." | |||
| 233 | (let ((map (make-sparse-keymap))) | 233 | (let ((map (make-sparse-keymap))) |
| 234 | ;; This map will inherit from `comint-mode-map' when entering | 234 | ;; This map will inherit from `comint-mode-map' when entering |
| 235 | ;; inferior-prolog-mode. | 235 | ;; inferior-prolog-mode. |
| 236 | (define-key map [remap self-insert-command] | ||
| 237 | 'inferior-prolog-self-insert-command) | ||
| 236 | map)) | 238 | map)) |
| 237 | 239 | ||
| 238 | (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table) | 240 | (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table) |
| @@ -300,6 +302,27 @@ Return not at end copies rest of line to end and sends it. | |||
| 300 | ;; Try again. | 302 | ;; Try again. |
| 301 | (inferior-prolog-process)))) | 303 | (inferior-prolog-process)))) |
| 302 | 304 | ||
| 305 | (defvar inferior-prolog-flavor 'unknown | ||
| 306 | "Either a symbol or a buffer position offset by one. | ||
| 307 | If a buffer position, the flavor has not been determined yet and | ||
| 308 | it is expected that the process's output has been or will | ||
| 309 | be inserted at that position plus one.") | ||
| 310 | |||
| 311 | (defun inferior-prolog-guess-flavor (&optional ignored) | ||
| 312 | (save-excursion | ||
| 313 | (goto-char (1+ inferior-prolog-flavor)) | ||
| 314 | (setq inferior-prolog-flavor | ||
| 315 | (cond | ||
| 316 | ((looking-at "GNU Prolog") 'gnu) | ||
| 317 | ((looking-at "Welcome to SWI-Prolog") 'swi) | ||
| 318 | ((looking-at ".*\n") 'unknown) ;There's at least one line. | ||
| 319 | (t inferior-prolog-flavor)))) | ||
| 320 | (when (symbolp inferior-prolog-flavor) | ||
| 321 | (remove-hook 'comint-output-filter-functions | ||
| 322 | 'inferior-prolog-guess-flavor t) | ||
| 323 | (if (eq inferior-prolog-flavor 'gnu) | ||
| 324 | (set (make-local-variable 'comint-process-echoes) t)))) | ||
| 325 | |||
| 303 | ;;;###autoload | 326 | ;;;###autoload |
| 304 | (defalias 'run-prolog 'switch-to-prolog) | 327 | (defalias 'run-prolog 'switch-to-prolog) |
| 305 | ;;;###autoload | 328 | ;;;###autoload |
| @@ -318,6 +341,22 @@ With prefix argument \\[universal-prefix], prompt for the program to use." | |||
| 318 | (inferior-prolog-run name)) | 341 | (inferior-prolog-run name)) |
| 319 | (pop-to-buffer inferior-prolog-buffer)) | 342 | (pop-to-buffer inferior-prolog-buffer)) |
| 320 | 343 | ||
| 344 | (defun inferior-prolog-self-insert-command () | ||
| 345 | "Insert the char in the buffer or pass it directly to the process." | ||
| 346 | (interactive) | ||
| 347 | (let* ((proc (get-buffer-process (current-buffer))) | ||
| 348 | (pmark (and proc (marker-position (process-mark proc))))) | ||
| 349 | (if (and (eq inferior-prolog-flavor 'gnu) | ||
| 350 | pmark | ||
| 351 | (null current-prefix-arg) | ||
| 352 | (eobp) | ||
| 353 | (eq (point) pmark) | ||
| 354 | (save-excursion | ||
| 355 | (goto-char (- pmark 3)) | ||
| 356 | (looking-at " \\? "))) | ||
| 357 | (comint-send-string proc (string last-command-char)) | ||
| 358 | (call-interactively 'self-insert-command)))) | ||
| 359 | |||
| 321 | (defun prolog-consult-region (compile beg end) | 360 | (defun prolog-consult-region (compile beg end) |
| 322 | "Send the region to the Prolog process made by \"M-x run-prolog\". | 361 | "Send the region to the Prolog process made by \"M-x run-prolog\". |
| 323 | If COMPILE (prefix arg) is not nil, use compile mode rather than consult mode." | 362 | If COMPILE (prefix arg) is not nil, use compile mode rather than consult mode." |
| @@ -338,7 +377,7 @@ If COMPILE (prefix arg) is not nil, use compile mode rather than consult mode." | |||
| 338 | If COMPILE (prefix arg) is not nil, use compile mode rather than consult mode." | 377 | If COMPILE (prefix arg) is not nil, use compile mode rather than consult mode." |
| 339 | (interactive "P\nr") | 378 | (interactive "P\nr") |
| 340 | (prolog-consult-region compile beg end) | 379 | (prolog-consult-region compile beg end) |
| 341 | (switch-to-buffer "*prolog*")) | 380 | (pop-to-buffer inferior-prolog-buffer)) |
| 342 | 381 | ||
| 343 | (defun inferior-prolog-load-file () | 382 | (defun inferior-prolog-load-file () |
| 344 | "Pass the current buffer's file to the inferior prolog process." | 383 | "Pass the current buffer's file to the inferior prolog process." |