emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comint-insert-input on non-command lines:


From: Luc Teirlinck
Subject: Re: comint-insert-input on non-command lines:
Date: Sat, 27 May 2006 21:11:58 -0500 (CDT)

Here are finally my proposed code and doc changes.  The code change
removes the misleading mouse-face and mouse-2 help-echo over old input
when `comint-use-prompt-regexp' is non-nil, because mouse-2 just yanks
as usual in that case.  The change to shell.el is minor: it just makes
the shell-mode docstring use shell-mode-map, even if `C-h f
shell-mode' was not done from a shell buffer.

I can install if desired.

===File ~/comint.el-diff====================================
Index: comint.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/comint.el,v
retrieving revision 1.345
diff -c -r1.345 comint.el
*** comint.el   26 May 2006 16:44:53 -0000      1.345
--- comint.el   28 May 2006 02:00:53 -0000
***************
*** 1510,1532 ****
                                (concat input "\n")))
  
          (let ((beg (marker-position pmark))
!             (end (if no-newline (point) (1- (point))))
!             (inhibit-modification-hooks t))
            (when (> end beg)
!             ;; Set text-properties for the input field
!             (add-text-properties
!              beg end
!              '(front-sticky t
!                font-lock-face comint-highlight-input
!                mouse-face highlight
!                help-echo "mouse-2: insert after prompt as new input"))
              (unless comint-use-prompt-regexp
                ;; Give old user input a field property of `input', to
                ;; distinguish it from both process output and unsent
                ;; input.  The terminating newline is put into a special
                ;; `boundary' field to make cursor movement between input
                ;; and output fields smoother.
!               (put-text-property beg end 'field 'input)))
            (unless (or no-newline comint-use-prompt-regexp)
              ;; Cover the terminating newline
              (add-text-properties end (1+ end)
--- 1510,1532 ----
                                (concat input "\n")))
  
          (let ((beg (marker-position pmark))
!               (end (if no-newline (point) (1- (point))))
!               (inhibit-modification-hooks t))
            (when (> end beg)
!             (add-text-properties beg end
!                                  '(front-sticky t
!                                    font-lock-face comint-highlight-input))
              (unless comint-use-prompt-regexp
                ;; Give old user input a field property of `input', to
                ;; distinguish it from both process output and unsent
                ;; input.  The terminating newline is put into a special
                ;; `boundary' field to make cursor movement between input
                ;; and output fields smoother.
!               (add-text-properties
!                beg end
!                '(mouse-face highlight
!                  help-echo "mouse-2: insert after prompt as new input"
!                  field input))))
            (unless (or no-newline comint-use-prompt-regexp)
              ;; Cover the terminating newline
              (add-text-properties end (1+ end)
============================================================

===File ~/shell.el-diff=====================================
*** shell.el    26 May 2006 16:27:31 -0500      1.137
--- shell.el    27 May 2006 18:30:48 -0500      
***************
*** 367,373 ****
  (put 'shell-mode 'mode-class 'special)
  
  (define-derived-mode shell-mode comint-mode "Shell"
!   "Major mode for interacting with an inferior shell.
  \\[comint-send-input] after the end of the process' output sends the text from
      the end of process to the end of the current line.
  \\[comint-send-input] before end of process output copies the current line 
minus the prompt to
--- 367,373 ----
  (put 'shell-mode 'mode-class 'special)
  
  (define-derived-mode shell-mode comint-mode "Shell"
!   "Major mode for interacting with an inferior shell.\\<shell-mode-map>
  \\[comint-send-input] after the end of the process' output sends the text from
      the end of process to the end of the current line.
  \\[comint-send-input] before end of process output copies the current line 
minus the prompt to
============================================================

===File ~/misc.texi-diff====================================
*** misc.texi   17 May 2006 23:42:26 -0500      1.85
--- misc.texi   27 May 2006 20:55:01 -0500      
***************
*** 873,889 ****
  Move point to the following prompt (@code{comint-next-prompt}).
  
  @kindex C-c RET @r{(Shell mode)}
! @findex comint-insert-input
  @item C-c @key{RET}
  Copy the input command which point is in, inserting the copy at the end
! of the buffer (@code{comint-insert-input}).  This is useful if you
  move point back to a previous command.  After you copy the command, you
  can submit the copy as input with @key{RET}.  If you wish, you can
! edit the copy before resubmitting it.
  
  @item Mouse-2
! Copy the input command that you click on, inserting the copy at the end
! of the buffer.
  @end table
  
    Moving to a previous input and then copying it with @kbd{C-c
--- 873,893 ----
  Move point to the following prompt (@code{comint-next-prompt}).
  
  @kindex C-c RET @r{(Shell mode)}
! @findex comint-copy-old-input
  @item C-c @key{RET}
  Copy the input command which point is in, inserting the copy at the end
! of the buffer (@code{comint-copy-old-input}).  This is useful if you
  move point back to a previous command.  After you copy the command, you
  can submit the copy as input with @key{RET}.  If you wish, you can
! edit the copy before resubmitting it.  If you use this command on an
! output line, it copies that line to the end of the buffer.
  
  @item Mouse-2
! Copy the old input command that you click on, inserting the copy at the end
! of the buffer (@code{comint-insert-input}).  This command only works if
! @code{comint-use-prompt-regexp} is @code{nil} (the default).
! If @code{comint-use-prompt-regexp} is address@hidden or if point is
! not over old input, @kbd{Mouse-2} just yanks as usual.
  @end table
  
    Moving to a previous input and then copying it with @kbd{C-c
============================================================

===File ~/inf-lisp-el-diff==================================
*** inf-lisp.el 10 Feb 2006 08:34:48 -0600      1.43
--- inf-lisp.el 27 May 2006 20:54:12 -0500      
***************
*** 232,262 ****
  documentation for variable `inferior-lisp-buffer'.
  
  \\{inferior-lisp-mode-map}
! 
! Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and
  `inferior-lisp-mode-hook' (in that order).
  
  You can send text to the inferior Lisp process from other buffers containing
  Lisp source.
!     switch-to-lisp switches the current buffer to the Lisp process buffer.
!     lisp-eval-defun sends the current defun to the Lisp process.
!     lisp-compile-defun compiles the current defun.
!     lisp-eval-region sends the current region to the Lisp process.
!     lisp-compile-region compiles the current region.
  
      Prefixing the lisp-eval/compile-defun/region commands with
      a \\[universal-argument] causes a switch to the Lisp process buffer after 
sending
      the text.
  
  Commands:
! Return after the end of the process' output sends the text from the
      end of process to point.
! Return before the end of the process' output copies the sexp ending at point
      to the end of the process' output, and sends it.
! Delete converts tabs to spaces as it moves back.
! Tab indents for Lisp; with argument, shifts rest
      of expression rigidly with the current line.
! C-M-q does Tab on each line starting within following expression.
  Paragraphs are separated only by blank lines.  Semicolons start comments.
  If you accidentally suspend your process, use \\[comint-continue-subjob]
  to continue it."
--- 232,269 ----
  documentation for variable `inferior-lisp-buffer'.
  
  \\{inferior-lisp-mode-map}
! \\<inferior-lisp-mode-map>
! Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
  `inferior-lisp-mode-hook' (in that order).
  
  You can send text to the inferior Lisp process from other buffers containing
  Lisp source.
!     `switch-to-lisp' switches the current buffer to the Lisp process buffer.
!     `lisp-eval-defun' sends the current defun to the Lisp process.
!     `lisp-compile-defun' compiles the current defun.
!     `lisp-eval-region' sends the current region to the Lisp process.
!     `lisp-compile-region' compiles the current region.
  
      Prefixing the lisp-eval/compile-defun/region commands with
      a \\[universal-argument] causes a switch to the Lisp process buffer after 
sending
      the text.
  
  Commands:
! \\[comint-send-input] after the end of the process' output sends the text 
from the
      end of process to point.
! \\[comint-send-input] before the end of the process' output copies the sexp 
ending at point
      to the end of the process' output, and sends it.
! \\[comint-copy-old-input] copies the sexp ending at point to the end of the 
process' output,
!     allowing you to edit it before sending it.
! If `comint-use-prompt-regexp' is nil (the default), \\[comint-insert-input] 
on old input
!    copies the entire old input to the end of the process' output, allowing
!    you to edit it before sending it.  If point is not on old input or if
!    `comint-use-prompt-regexp' is non-nil, \\[comint-insert-input] behaves 
according to
!    its global binding.
! \\[backward-delete-char-untabify] converts tabs to spaces as it moves back.
! \\[lisp-indent-line] indents for Lisp; with argument, shifts rest
      of expression rigidly with the current line.
! \\[indent-sexp] does \\[lisp-indent-line] on each line starting within 
following expression.
  Paragraphs are separated only by blank lines.  Semicolons start comments.
  If you accidentally suspend your process, use \\[comint-continue-subjob]
  to continue it."
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]