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: A trivial fix, a quibble,


From: Luc Teirlinck
Subject: Re: comint-insert-input on non-command lines: A trivial fix, a quibble, and a bug
Date: Tue, 9 May 2006 09:58:24 -0500 (CDT)

Nick Roberts wrote:

   Well it fixes:

     Yes, but if comint-use-prompt-regexp is t, then comint-insert-input
     does nothing even if point _is_ over input.

Did you try it?  It does not work for me when I try it and I can not
see anything in Miles' code that could make it work.

   Why would they want to `adapt' comint-copy-old-input?  They seem to use
   comint-get-old-input which *is* stll present in comint.el.

But no longer called by comint-get-old-input's replacement function.

When taling about Miles' patch are we talking about the same thing?
I thought that you meant:

(defun comint-insert-input (&optional event)
  "In a Comint buffer, set the current input to the previous input at point."
        ;; This doesn't use "e" because it is supposed to work
        ;; for events without parameters.
        (interactive (list last-input-event))
        (when event
          (posn-set-point (event-end event)))
        (let ((pos (point)))
          (if (not (eq (field-at-pos pos) 'input))
              ;; No input at POS, fall back to the global definition.
              (let* ((keys (this-command-keys))
                     (last-key (and (vectorp keys) (aref keys (1- (length 
keys)))))
                     (fun (and last-key (lookup-key global-map (vector 
last-key)))))
                (goto-char pos)
                (and fun (call-interactively fun)))
            (setq pos (point))
            ;; There's previous input at POS, insert it at the end of the 
buffer.
            (goto-char (point-max))
            ;; First delete any old unsent input at the end
            (delete-region
             (or (marker-position comint-accum-marker)
                 (process-mark (get-buffer-process (current-buffer))))
             (point))
            ;; Insert the input at point
            (insert (field-string-no-properties pos)))))

(defun field-at-pos (pos)
  "Return the field at position POS, taking stickiness etc into account"
  (let ((raw-field (get-char-property (field-beginning pos) 'field)))
    (if (eq raw-field 'boundary)
        (get-char-property (1- (field-end pos)) 'field)
      raw-field)))





reply via email to

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