[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding String to Beginning of Lines
From: |
Christopher Dimech |
Subject: |
Re: Adding String to Beginning of Lines |
Date: |
Tue, 10 Nov 2020 18:52:04 +0100 |
Have tried to add a keybinding for the function, but after pressing
the keyseq, I am getting "H-z is undefined".
(define-key emacs-lisp-mode-hook (kbd "H-z") 'rec-field-nwltok)
> Sent: Tuesday, November 10, 2020 at 3:49 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Adding String to Beginning of Lines
>
> Christopher Dimech <dimech@gmx.com> 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)
>
> Ok.
>
> 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
> like:
>
> (defun rec-cont (beg end s)
> (interactive (list (region-beginning)
> (region-end)
> (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".
>
>
> Michael.
>
- Re: Adding String to Beginning of Lines, (continued)
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines,
Christopher Dimech <=
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Christopher Dimech, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Jean Louis, 2020/11/10
- Re: Adding String to Beginning of Lines, Michael Heerdegen, 2020/11/10
- Re: Adding String to Beginning of Lines, Jean Louis, 2020/11/10