From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Adding String to Beginning of Lines Date: Tue, 10 Nov 2020 15:49:38 +0100 Message-ID: <87imadb725.fsf@web.de> References: <20201110111024.GA15992@tuxteam.de> <87zh3pctr1.fsf@web.de> <87o8k5csqj.fsf@web.de> <874klxcn6k.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25578"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 10 15:56:08 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcV44-0006XD-8L for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 10 Nov 2020 15:56:08 +0100 Original-Received: from localhost ([::1]:41758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcV43-0006t1-AD for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 10 Nov 2020 09:56:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcUxv-0008Dp-U8 for help-gnu-emacs@gnu.org; Tue, 10 Nov 2020 09:49:47 -0500 Original-Received: from mout.web.de ([212.227.15.3]:47565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcUxs-0003kX-EE for help-gnu-emacs@gnu.org; Tue, 10 Nov 2020 09:49:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1605019779; bh=nZS+u9AfU45rESyD7qWsDXnOgo33p+phIOUxbf3P360=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=al5EvX1ztJOmRtR8+4cJjyP+3kknb5/sMJ+WkRqsvN0LJYxN/49yu3Cy/TtEeuOQ4 PwptzFa9sp8vhJ+RdNncR9YokMsq119feM7A55w3ChHviEYaSqKr1xAewTkWkWH1Wg 5btUPLlrz8K8nByQJhGidVONUJ32rq5UgHmxDZJs= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([94.218.215.213]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MAMY6-1kQuO91dEo-00BeVp; Tue, 10 Nov 2020 15:49:39 +0100 In-Reply-To: (Christopher Dimech's message of "Tue, 10 Nov 2020 15:38:39 +0100") X-Provags-ID: V03:K1:bfB0zdXADbE869TXlWhLSw6I6gEE7fTCuVfY/GW8bCyb+xQ03Kv Gu8rV81IS0sHANmXLVpcnTtGlAbGpaQtn40TuknuMHtzQbNsvl645XLcLbkxjN8fAkeMxO6 fBNeDuz1RsceEZL13NFk1iFPBSJzGHXiZroE1Qt0gpJa3Q4KGrNsQ+f6L7XzTBGESLy44u2 VVGn2zb1Q1PYRwqowYsCw== X-UI-Out-Filterresults: notjunk:1;V03:K0:gwdWWLsgA/Q=:9E1kHEWzCxYPsEHsz7uqFB 1vBXBzgAxqa5sDjZqt0hYKvHg+hhtho6lJzlMjRAW6DFjO9sHRfV/KcAFG34YWR10TyzCikaD eBaiqvqxgzb0Sz/JMjM6f8KzxcK9KyjzOU+z3asTYV2KRnvpuOCfyr/lMzulMQsWv4RBoeDBa 5NECwHZ1K13cGnsue2MVGaCP4Thb0LtsL+YPMEkD91zEtHjoTsDMyWGTqxwYRylNGvJFnBVjw j1SopQCRw7ezrk/BtCwZIJ4Mly4+yJf47k8wcohgb363xS+2Nyc3ZjG5hqBvuKDF/2axtWAL8 aolYYDpjx9MPIiBnEN2KQOfJNTbzlBVLCmsbjpXaVEmX4zIsK/tgTBdDScZsdPS4wl545tqN3 T2xcPqQkuWEJVePtzKMiXPHQ0iDelyRqa4Vcpu+fBjK9DYPqyNfd+zVO8wBdR6g6myA/SpnAP KoHWATFXdw4WsQ4oWdkmEuj5LtGa00EBhLtGHgUzwOXeiM0/pC6ae/d9VQ2dPY+eEquicc5ul at5SkVsh00lRIBPEv1Q1Op36BjyVq5g6mPbSKc5cIEjJE0cAR1ILY36903/Ds+kqYwr3/hCS0 AS5Dw0typEBdXN6odstRh9rXd/bP1uag6yeSMEfJbfaLnp3ntrK/76FKq1XTwCJCS4HBOVgvu S6hmrG2UO8o+7n8M2aMvmF/dA8PWkz9B6eYO963ghhAjSLJZVRQDKajIv2i0IFMFhGIIas3cc yvO5BWpDIvcItZiVFjaGRzJVXuc4wba1DV3AIUpJ9QwayMNXuuvJzzM5mDDmVVa2zRI2DZnR Received-SPF: pass client-ip=212.227.15.3; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/10 09:49:39 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:125193 Archived-At: 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) 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.