bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#61069: 30.0.50; comint-copy-old-input should include continuation li


From: Robert Pluim
Subject: bug#61069: 30.0.50; comint-copy-old-input should include continuation lines
Date: Mon, 30 Jan 2023 09:25:19 +0100

>>>>> On Fri, 27 Jan 2023 19:45:33 -0800, Bob Rogers <rogers@rgrjr.com> said:
   Bob> Then the following should fit the bill.  Given that this solution
    Bob> introduces a defcustom, I imagine it should also have a NEWS item as
    Bob> well . . .

Yes. And a :version on the new defcustom itself.

    Bob>                                        -- Bob

    Bob> * lisp/shell.el (shell-get-old-input-include-continuation-lines): New
    Bob> defcustom (default nil).
    Bob> (shell-get-old-input): Like comint-get-old-input-default but include
    Bob> all continuation lines if the above is true.
    Bob> (shell-mode): Install shell-get-old-input. (bug#61069)

Two spaces after '.'

    Bob> +(defcustom shell-get-old-input-include-continuation-lines nil
    Bob> +  "If non-nil, shell-get-old-input-default includes \"\\\" lines."
    Bob> +  :type 'boolean
    Bob> +  :group 'shell)
    Bob> +

"Whether `shell-get-old-input-default' includes \"\\\" lines."

    Bob> +(defun shell-get-old-input ()
    Bob> +  "Default for `comint-get-old-input' in shell-mode.
    Bob> +If `comint-use-prompt-regexp' is nil, then either
    Bob> +return the current input field, if point is on an input field, or the
    Bob> +current line, if point is on an output field.
    Bob> +If `comint-use-prompt-regexp' is non-nil, then return
    Bob> +the current line with any initial string matching the regexp
    Bob> +`comint-prompt-regexp' removed.  In either case, if
    Bob> +shell-get-old-input-include-continuation-lines is non-nil and the
    Bob> +current line ends with a backslash, the next line is also included and
    Bob> +examined for a backslash, ending with a final line without a 
backslash."
    Bob> +  (let (field-prop bof)
    Bob> +    (if (and (not comint-use-prompt-regexp)
    Bob> +             ;; Make sure we're in an input rather than output field.
    Bob> +             (not (setq field-prop (get-char-property
    Bob> +                                    (setq bof (field-beginning)) 
'field))))
    Bob> +      (field-string-no-properties bof)

Emacs uses spaces only in elisp. We even have a .dir-locals.el
enforcing that.

Robert
-- 





reply via email to

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