From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Regexp with comment character of buffer Date: Mon, 12 Aug 2024 19:26:03 +0700 Message-ID: References: <5my4_hPxAvHxrSRXBqG0sOdSxA9OXe9rRX9fl7efeXWgi5h6EAw4Oh3a7VllRQNz6URMUcjIPkRcOGMn6RCYxbF0Au7lTb2BCkm4ffPuv3A=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27359"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 12 14:26:43 2024 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 1sdU8J-0006vI-Cy for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 12 Aug 2024 14:26:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdU7w-0002vF-7a; Mon, 12 Aug 2024 08:26:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdU7u-0002u7-B3 for help-gnu-emacs@gnu.org; Mon, 12 Aug 2024 08:26:18 -0400 Original-Received: from mail-ua1-x92c.google.com ([2607:f8b0:4864:20::92c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdU7s-0006bj-MB for help-gnu-emacs@gnu.org; Mon, 12 Aug 2024 08:26:18 -0400 Original-Received: by mail-ua1-x92c.google.com with SMTP id a1e0cc1a2514c-82175064454so1413520241.2 for ; Mon, 12 Aug 2024 05:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723465575; x=1724070375; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JDPWmWQHGkFDE6NXWzwIUxE35wJv0E2fKt2Q/Kx5zPs=; b=T4EW04kVVEH4NUwsPahBFpf/vzDTCA6s1CUZsY8ZtyS99Hj0hAQ2Wqh8Uj8M35jbjZ 3OzI3bpLSEmoLyKcVRbM8mxKw7jr+rZNhv1JSVwkvxdMoi9LwcT9CMXmcpWzCUsEzSws cYVCrkY2jS+WUK6c9kp1hiI6HICAH4zpsOk0rYzoG+EuVyCrnu31VVHM++cTRBUkvCEA CkXwy4wUzByi+/qaqglTxHTmNEcjzaSvvuWBLCDMrr7LOQtbU/tgZ7cxzDGX/n86VQkm FIBcJYYb29HWXVooabi9gk0S7whD6blAlHZgzP09dLYx3IqlGRD/TC2dQOh5HA3YDa9t jL8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723465575; x=1724070375; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JDPWmWQHGkFDE6NXWzwIUxE35wJv0E2fKt2Q/Kx5zPs=; b=DnNMSbnFuh0T5gy9Z+1JQBtj3K+xLAvGBMYBz2NshJVU8un7uUWSL+beIYmeb32vrW zIp8jHxjuMjj9tnfjLP4JbTxv6IVvz4LaksT3HkHkbBeB5wF76gXN77LV0ndyB7CnmIA XRguM4JFYrLTsJJV8Th4ptjSka+VwpApEwcJ+tvwaB7nJAwdTtsjFviV2QTp+PCEpigL QvZ2gddApIqHARXDCWmGceMWHc/rBeHWnbgYrfGG5eUcOp9POwUozkybYU0go2ZStW6g pSDWCu7Z9Kt7JzupjUMKVtcYMGbuC/ohMxX2tP8DHw5sOolzEGvE4+TJcPRJueEw9wlN 3Hhg== X-Gm-Message-State: AOJu0YxO/OLQWa95rIR+psAUBH5XIaI7L3ouIJ4qc/Fhw8NV9rcfTxJF ImZvqBn0w5nwpN3X8OlaKj8J4mxlJn/FWPL9uP3NVtiKL/ZoMy3dEnx9sM55ix5gOytRCF641KP XT4x5rPYVIN5j12nlV2ZcYPviyYhXlciTriA= X-Google-Smtp-Source: AGHT+IHIt0LwcH+rAXQQ/cYhjx6T8PEIZ5jUrYZ63RPuzktT2GOkBuAHw6SD/CD1g1t52bLumj9+Z/YP6KUXC5B5Ey8= X-Received: by 2002:a05:6102:3592:b0:493:bedd:1da4 with SMTP id ada2fe7eead31-497439a9242mr258564137.7.1723465575441; Mon, 12 Aug 2024 05:26:15 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::92c; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x92c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147635 Archived-At: On Mon, 12 Aug 2024 at 18:41, Heime wrote: > > > How can I change the regexp so that instead of the beginning ;;; > > > I use the comment character of the current buffer, replicated three > > > times ? > > > > > > (let ( (heading-regexp "^;;;\\s-+\\([HM][[:digit:]]\\)\\s-") > Have done the following. Do I really need all this or are there better ways ? > > (let* ((comment-char (regexp-quote (string-trim comment-start))) > (three-comment-chars (make-string 3 (string-to-char comment-char))) Does that work for you? (If not, go back to solving the problem.) Does that work in all scenarios that are important to you? (If not, go back to solving the problem in a more general way.) What aspects of the working solution seem unsatisfactory to you? What hypothetical capabilities would you require in order to improve those aspects?