From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vitaliy Chepelev via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73445: [PATCH] image-dired: quote file name fore search-forward-regexp Date: Tue, 24 Sep 2024 04:55:46 -0000 Message-ID: <871q19k5v1.fsf@gmx.com> Reply-To: Vitaliy Chepelev Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25531"; mail-complaints-to="usenet@ciao.gmane.io" To: 73445@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 24 07:33:20 2024 Return-path: Envelope-to: geb-bug-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 1ssyAq-0006SD-3l for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Sep 2024 07:33:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ssyAD-0004ao-NK; Tue, 24 Sep 2024 01:32:41 -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 1ssyAA-0004OV-QX for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 01:32:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ssyAA-00019D-Fy for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 01:32:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=abOAwcT7nG0u4F/SYF3cJWfiOJFqmrheyEJevBUfN2A=; b=qd/huJnEcMTsePuL3u68BHn7nFXxl57ibLMJUkF1tyZe6N8trN4gJU4rze6yh0MLBR61rcb/ItP6e4Lvbvb9OEARKdFUYFfGcyFD4ROHdzjLev0u8ocsNl3Nf9TXw8BIPxqLadyntoaI1Gv+D3XGoh0rhWpLbnVS8UYVjRjEbLTDMp25F3EpVZxAlK5w9r4OIvA/nGPXhv6dF4EMAOBqOdU6qzkPEqe77pYFh0vaeo0AWXU7LukXCta7VrcDfw10JA09tH+rDGrhSiaEGG6nzYiSZ+MvV+KKdpjkinGcxeRisXNSvshCemnVtQbbLAdaO5DQxWygLya4BEb2w/CKTg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ssyAY-0000Kl-5q for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 01:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vitaliy Chepelev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Sep 2024 05:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73445 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17271559311188 (code B ref -1); Tue, 24 Sep 2024 05:33:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Sep 2024 05:32:11 +0000 Original-Received: from localhost ([127.0.0.1]:45050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssy9h-0000Iy-4T for submit@debbugs.gnu.org; Tue, 24 Sep 2024 01:32:11 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:40760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssxc1-0006Zs-8j for submit@debbugs.gnu.org; Tue, 24 Sep 2024 00:57:21 -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 1ssxbd-0005YB-4M for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 00:56:57 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ssxbb-00064g-B8 for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 00:56:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.com; s=s31663417; t=1727153813; x=1727758613; i=vitalij@gmx.com; bh=abOAwcT7nG0u4F/SYF3cJWfiOJFqmrheyEJevBUfN2A=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=tzw/nV9hE52qLCmo8FUNeksofUeZIDG6O9AhKThbwkfaZWq7447M4fspw6ztFweU Se8vkX+FjpwOOlvDLNLRDPcN/VPZ6ToU4BPOea7R/4K4OquwusKfZD6QviNa6Xzxb a3r/5QxAA61Um0RQfHrfkXxV7ygutyPbUcWmCC8iEDmYtsatCBO83ab1AYIgoAdde OcX6oBTE/kRG8iVgrYotiycytfWfqyH+fj67kU9u2llclKltXOf+UJy9E7naN9xWf CHtpV0BqPHYqXauTRJi6EqPIMlUMwqKVPBKRW4w3UEewiSNSpZi7sirzte8ZgjZ5P XS4vu3EHXTRQKF5SlQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from localhost ([217.196.104.210]) by mail.gmx.net (mrg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qjhobkcm4GlcOmJbvP6I6W0VmiSglRjJDQ/7hbwTFNrpdCePlE 3K01r4bDh8xAB5sUj+H7tgUVLY0fgYl5enbtSPLJsoLVM8vLPiEy2uttuwaL1/B0/XD85Z0d Received-SPF: pass client-ip=212.227.17.20; envelope-from=vitalij@gmx.com; helo=mout.gmx.net 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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 24 Sep 2024 01:32:05 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292302 Archived-At: --=-=-= Content-Type: text/plain Tags: patch In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, X toolkit) of 2024-07-29 built on localhost Windowing system distributor 'The X.Org Foundation', version 11.0.12101013 System Description: Gentoo Linux --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-image-dired-quote-file-name-fore-search-forward-rege.patch Content-Transfer-Encoding: quoted-printable =46rom d0e7b67e10d3ecb34969c0af18ef6317fd96636d Mon Sep 17 00:00:00 2001 From: none Date: Tue, 24 Sep 2024 04:25:13 +0000 Subject: [PATCH] image-dired: quote file name fore search-forward-regexp For example when you have file with name "file[image].jpg". and use M-x im= age-dired you will have error: image-dired-list-tags: Invalid regexp: "Unm= atched [ or [^" =2D-- lisp/image/image-dired-dired.el | 2 +- lisp/image/image-dired-tags.el | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dire= d.el index 7219a10..c4e82e9 100644 =2D-- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el @@ -383,7 +383,7 @@ matching tag will be marked in the Dired buffer." (file-name-directory curr-file))) (setq curr-file (file-name-nondirectory curr-file)) (goto-char (point-min)) - (when (search-forward-regexp (format "\\s %s[*@]?$" curr-file) ni= l t) + (when (search-forward-regexp (format "\\s %s[*@]?$" (regexp-quote= curr-file)) nil t) (setq hits (+ hits 1)) (dired-mark 1)))) (message "%d files with matching tag marked" hits))) diff --git a/lisp/image/image-dired-tags.el b/lisp/image/image-dired-tags.= el index 54595ad..828372e 100644 =2D-- a/lisp/image/image-dired-tags.el +++ b/lisp/image/image-dired-tags.el @@ -79,7 +79,7 @@ FILE-TAGS is an alist in the following form: (setq file (car elt) tag (cdr elt)) (goto-char (point-min)) - (if (search-forward-regexp (format "^%s.*$" file) nil t) + (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) = nil t) (progn (setq end (point)) (beginning-of-line) @@ -103,7 +103,7 @@ FILES can be a name of a single file (a string) or a l= ist of file names." (error "Files must be a string or a list of strings!"))) (dolist (file files) (goto-char (point-min)) - (when (search-forward-regexp (format "^%s;" file) nil t) + (when (search-forward-regexp (format "^%s;" (regexp-quote file)) = nil t) (end-of-line) (setq end (point)) (beginning-of-line) @@ -125,7 +125,7 @@ Value is a list of all tags for FILE." (image-dired-sane-db-file) (image-dired--with-db-file (let (end (tags "")) - (when (search-forward-regexp (format "^%s" file) nil t) + (when (search-forward-regexp (format "^%s" (regexp-quote file)) nil= t) (end-of-line) (setq end (point)) (beginning-of-line) @@ -179,7 +179,7 @@ FILE-COMMENTS is an alist on the following form: (setq file (car elt) comment (cdr elt)) (goto-char (point-min)) - (if (search-forward-regexp (format "^%s.*$" file) nil t) + (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) = nil t) (progn (setq end (point)) (beginning-of-line) @@ -236,7 +236,7 @@ Optionally use old comment from FILE as initial value.= " (image-dired-sane-db-file) (image-dired--with-db-file (let (end comment-beg-pos comment-end-pos comment) - (when (search-forward-regexp (format "^%s" file) nil t) + (when (search-forward-regexp (format "^%s" (regexp-quote file)) nil= t) (end-of-line) (setq end (point)) (beginning-of-line) =2D- 2.44.2 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D- Best regards, --=-=-=--