[Top][All Lists]

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

Re: Adding String to Beginning of Lines

From: Michael Heerdegen
Subject: Re: Adding String to Beginning of Lines
Date: Tue, 10 Nov 2020 15:49:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech <> writes:

> Correct,  the replacement.  Because in .el files, the replacement will be
> ";; + ", in other languages, it is dependent on the symbol for comments
> (e.g. "!! +" for fortran code .f)


If you prefer to have `interactive' return the default, then: a
not-stringish sexp as interactive spec is evaluated normally, and
expected to return the list of arguments.  So you could use something

(defun rec-cont (beg end s)
  (interactive (list (region-beginning)
                     (read-string "Prefix: " nil nil "your-default")))
  (replace-regexp "^" s nil beg end))

You can also use an expression to provide a default depending on the
current mode, e.g.

  (if comment-start (concat comment-start " +") ";; +")

instead of a constant string "your-default".


reply via email to

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