From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jun 2025 12:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 78719@debbugs.gnu.org Cc: Daniel Mendler , Eli Zaretskii , Drew Adams , juri@linkov.net X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174938426319400 (code B ref -1); Sun, 08 Jun 2025 12:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jun 2025 12:04:23 +0000 Received: from localhost ([127.0.0.1]:50880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOElC-00052p-Tl for submit@debbugs.gnu.org; Sun, 08 Jun 2025 08:04:23 -0400 Received: from lists.gnu.org ([2001:470:142::17]:33312) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOEl8-00052T-0P for submit@debbugs.gnu.org; Sun, 08 Jun 2025 08:04:20 -0400 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 1uOEl2-0008Av-9N for bug-gnu-emacs@gnu.org; Sun, 08 Jun 2025 08:04:12 -0400 Received: from smtp-4.orcon.net.nz ([60.234.4.59]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOEkx-0008V7-9Y; Sun, 08 Jun 2025 08:04:10 -0400 Received: from [10.253.37.70] (port=45756 helo=webmail.orcon.net.nz) by smtp-4.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1uOEkc-0007SS-IG; Mon, 09 Jun 2025 00:03:51 +1200 Received: from ip-115-69-187-4.as55850.net ([115.69.187.4]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Mon, 09 Jun 2025 00:03:46 +1200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 09 Jun 2025 00:03:46 +1200 From: Phil Sainty Message-ID: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- Received-SPF: pass client-ip=60.234.4.59; envelope-from=psainty@orcon.net.nz; helo=smtp-4.orcon.net.nz X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) This is a spin-off from bug#78658 -- and following on from https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78658#65 in particular -- to add friendlier alternatives to `try-completion' for efficiently obtaining a common string prefix or completion from a collection of strings outside of the context of minibuffer completion. E.g. when you simply want to know the longest common prefix from a list of strings without having to deal with any completion variables or edge-case return values. Unlike `try-completion' which may return nil or t, the new functions always return a string, simplifying their usage and (on account of the "string-*" naming) making the functionality more discoverable for programmers working with strings. The function `string-try-completion' provides the general case and is just like `try-completion' except for always returning a string. The function `string-common-prefix' is the simpler case wanted for bug#78658, taking fewer arguments and binding the variables `completion-regexp-list' and `completion-ignore-case'. I've pushed a branch scratch/string-common-prefix with the following commit for review: https://cgit.git.savannah.gnu.org/cgit/emacs.git/commit/?h=scratch/string-common-prefix&id=accfe19887f3573dd55f5272f92899afa1e2f446 (Plus a fixup commit removing the unintended additional NEWS entry.) -Phil In GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2025-02-25 built on phil-lp Repository revision: 8ac894e2246f25d2a2a97d866b10e6e0b0fede5a Repository branch: HEAD Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Ubuntu 22.04.5 LTS Configured using: 'configure --prefix=/home/phil/emacs/30.x.nc/usr/local --with-native-compilation=aot --with-x-toolkit=lucid --without-sound '--program-transform-name=s/^ctags$/ctags_emacs/'' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XPM LUCID ZLIB Important settings: value of $LC_MONETARY: en_NZ.UTF-8 value of $LC_NUMERIC: en_NZ.UTF-8 value of $LC_TIME: en_NZ.UTF-8 value of $LANG: en_GB.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8 Major mode: Magit Rev Minor modes in effect: icomplete-mode: t magit-wip-initial-backup-mode: t magit-wip-before-change-mode: t magit-wip-after-apply-mode: t magit-wip-after-save-mode: t magit-wip-mode: t global-git-commit-mode: t magit-auto-revert-mode: t global-window-tool-bar-mode: t window-tool-bar-mode: t bug-reference-mode: t minibuffer-line-mode: t server-mode: t savehist-mode: t global-anzu-mode: t anzu-mode: t my-contextual-help-mode: t global-so-long-mode: t global-visible-mark-mode: t visible-mark-mode: t repeat-mode: t display-battery-mode: t my-visible-bell-mode: t global-display-fill-column-indicator-mode: t minibuffer-depth-indicate-mode: t which-key-mode: t keep-buffers-mode: t global-subword-mode: t subword-mode: t global-hl-line-mode: t display-time-mode: t recentf-mode: t my-global-keys-local-minor-mode: t my-keys-local-minor-mode: t windmove-mode: t url-handler-mode: t auto-compile-on-load-mode: t auto-compile-on-save-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-history-mode: t tab-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t minibuffer-regexp-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/phil/.emacs.d/el-get/scratch/el-get hides /home/phil/.emacs.d/el-get/el-get/el-get /home/phil/.emacs.d/el-get/avy/avy hides /home/phil/.emacs.d/elpa/avy-0.5.0/avy /home/phil/.emacs.d/el-get/dash/dash hides /home/phil/.emacs.d/elpa/dash-2.19.1/dash /home/phil/.emacs.d/el-get/iedit/iedit hides /home/phil/.emacs.d/elpa/iedit-0.9.9.9.9/iedit /home/phil/.emacs.d/my-lisp/psysh hides /home/phil/.emacs.d/elpa/psysh-0.4.9/psysh /home/phil/.emacs.d/elpa/transient-0.7.9/transient hides /home/phil/emacs/30.x.nc/usr/local/share/emacs/30.1/lisp/transient /home/phil/.emacs.d/el-get/which-key/which-key hides /home/phil/emacs/30.x.nc/usr/local/share/emacs/30.1/lisp/which-key Features: (shadow sort ecomplete mail-extr emacsbug tramp trampver tramp-integration tramp-message tramp-compat xdg parse-time iso8601 tramp-loaddefs term disp-table ehelp pcmpl-gnu pcmpl-unix sh-script smie treesit two-column emacs-news-mode noutline outline cua-rect cua-base find-dired whitespace reposition wgrep texinfo texinfo-loaddefs dired-aux jinx magit-extras magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply ibuf-ext ibuffer ibuffer-loaddefs ucs-normalize shortdoc icomplete face-remap hippie-exp executable files-x winnow magit-wip magit-log which-func imenu magit-diff smerge-mode diff git-commit log-edit message sendmail yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process with-editor shell pcomplete magit-mode transient edmacro magit-git magit-section magit-utils crm dash misearch multi-isearch hi-lock compare-w project find-func help-fns window-tool-bar tab-line compat view mule-util holidays holiday-loaddefs cal-julian lunar solar cal-dst vc-git diff-mode track-changes vc-dispatcher autoinsert bug-reference goto-addr appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs lexbind-mode hl-sexp fic-mode elide-head idle-highlight-mode completion-preview sockit tabify minibuffer-line server my-org my-projects my-session savehist desktop frameset my-mail my-libraries sudo anzu my-version-control my-text my-programming so-long my-rectangles rect my-utilities browse-kill-ring my-configuration visible-mark cus-edit pp cus-load dired-details dired-x repeat highlight-parentheses format-spec battery delight delsel ffap thingatpt display-fill-column-indicator mb-depth which-key pcase easy-mmode keep-buffers cap-words superword subword hl-line time recentf tree-widget wid-edit atomic-chrome websocket bindat let-alist my-whitespace ws-trim my-externals .loaddefs rainbow-mode notify dbus xml mo-git-blame cl iedit el-get autoload loaddefs-gen radix-tree lisp-mnt dired dired-loaddefs my-holidays my-local kmacro my-mahara grep tks generic-x catalyst redshift-indent my-keybindings framemove advice windmove my-startup-log time-date adaptive-wrap-autoloads ...) Memory information: ((conses 16 1246250 374539) (symbols 48 43403 2) (strings 32 196192 27442) (string-bytes 1 7837076) (vectors 16 94255) (vector-slots 8 1904715 340289) (floats 8 927 9358) (intervals 56 128211 16974) (buffers 992 50)) From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jun 2025 12:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Phil Sainty Cc: 78719@debbugs.gnu.org, eliz@gnu.org, drew.adams@oracle.com, juri@linkov.net X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, Eli Zaretskii , Drew Adams , juri@linkov.net Received: via spool by submit@debbugs.gnu.org id=B.174938535222704 (code B ref -1); Sun, 08 Jun 2025 12:23:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jun 2025 12:22:32 +0000 Received: from localhost ([127.0.0.1]:50903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOF2l-0005u8-MV for submit@debbugs.gnu.org; Sun, 08 Jun 2025 08:22:32 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43544) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOF2h-0005to-OB for submit@debbugs.gnu.org; Sun, 08 Jun 2025 08:22:29 -0400 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 1uOF2X-0004IR-Ni for bug-gnu-emacs@gnu.org; Sun, 08 Jun 2025 08:22:18 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOF2V-00023j-Fe; Sun, 08 Jun 2025 08:22:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qAAdFSr5HQih4P9CawN0qZg7X92I7FgKf8oDn21Un28=; b=rOarHxZOOu7uIO7UwWTQZFCRtJ kd9YhkPfq0kLLsaCG7Delmi+tjbV6FWR1IV+Wlh5A2MIcF1h8zLqcT+PLUf4gHOnhlBBxAzLDqSpn A7m/trojyXj5gpOPlQyJ0hTdzvJdZV17k0dlRmA4hruXhV00AWpg6vUCtJswGHQ2O2ZA=; From: Daniel Mendler In-Reply-To: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> Date: Sun, 08 Jun 2025 14:21:52 +0200 Message-ID: <87wm9mh19b.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a01:4f8:c012:9177::1; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Phil Sainty writes: > This is a spin-off from bug#78658 -- and following on from > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78658#65 in particular -- > to add friendlier alternatives to `try-completion' for efficiently > obtaining a common string prefix or completion from a collection of > strings outside of the context of minibuffer completion. > > E.g. when you simply want to know the longest common prefix from a > list of strings without having to deal with any completion variables > or edge-case return values. > > Unlike `try-completion' which may return nil or t, the new functions > always return a string, simplifying their usage and (on account of > the "string-*" naming) making the functionality more discoverable > for programmers working with strings. > > The function `string-try-completion' provides the general case and > is just like `try-completion' except for always returning a string. What is the purpose of having a separate function `string-try-completion'? I think it is confusing if the function respects the `completion-regexp-list' and `completion-ignore-case' dynamic variables, and if we end up with three functions `try-completion', `string-try-completion', and `completions-try-completion'. Why not only provide a single function `string-expand-prefix' with additional keyword or optional arguments: (cl-defun string-common-prefix (strings &key ignore-case regexps predicate)) The STRING or initial prefix argument seems redundant, since one can always use the empty string, and use `string-prefix-p' to check a desired prefix, or am I missing something? (cl-defun string-common-prefix (strings &key prefix ignore-case regexps predicate)) Daniel From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jun 2025 12:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Mendler , Stefan Monnier Cc: psainty@orcon.net.nz, 78719@debbugs.gnu.org, drew.adams@oracle.com, juri@linkov.net X-Debbugs-Original-Cc: psainty@orcon.net.nz, bug-gnu-emacs@gnu.org, drew.adams@oracle.com, juri@linkov.net Received: via spool by submit@debbugs.gnu.org id=B.174938612025138 (code B ref -1); Sun, 08 Jun 2025 12:36:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jun 2025 12:35:20 +0000 Received: from localhost ([127.0.0.1]:50917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOFFA-0006XO-4O for submit@debbugs.gnu.org; Sun, 08 Jun 2025 08:35:20 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60840) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOFF5-0006TG-BL for submit@debbugs.gnu.org; Sun, 08 Jun 2025 08:35:18 -0400 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 1uOFEz-0006tP-CH for bug-gnu-emacs@gnu.org; Sun, 08 Jun 2025 08:35:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOFEx-0003Gq-2u; Sun, 08 Jun 2025 08:35:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9vHtzgpTdL+pPwNV0KgoyVkwb0vdXe/PiKmkL9VBgHc=; b=G1HrBFPR3Dr9 BMhx8Eb3OLcgH1An5TV/F+EUThoD7E0VTdEFyXqyqP++acRkq31+x1PP/MDIG41w3jQjJUrj81PgJ 9QQcLq/gR2R+pyJ1x14G2sPamW4cZEAABpJUuDLIbcHa4Iif+Jt0ovK4Qk3zMDKYraYW3iBbMaNxQ wQgObkX4/7DbFbIvhs0xUD2gHstCAUqS5aJTaatRENCZTJfG7yplXu09ep6NpV2MBFUqagpn9fr2Z mlWu+QLhZJKWzwcYZqq4pV911sUt9KP+0o8ZXG/ep42veYIBNX4mKlsJ6B40ee/oabPCOsrOoTQB0 EZ2wyz0/6V3B0W8wjnAICA==; Date: Sun, 08 Jun 2025 15:35:03 +0300 Message-Id: <8634cah0nc.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87wm9mh19b.fsf@daniel-mendler.de> (message from Daniel Mendler on Sun, 08 Jun 2025 14:21:52 +0200) References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Daniel Mendler > Cc: bug-gnu-emacs@gnu.org, Eli Zaretskii , Drew Adams > , juri@linkov.net > Date: Sun, 08 Jun 2025 14:21:52 +0200 > > Phil Sainty writes: > > > This is a spin-off from bug#78658 -- and following on from > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78658#65 in particular -- > > to add friendlier alternatives to `try-completion' for efficiently > > obtaining a common string prefix or completion from a collection of > > strings outside of the context of minibuffer completion. > > > > E.g. when you simply want to know the longest common prefix from a > > list of strings without having to deal with any completion variables > > or edge-case return values. > > > > Unlike `try-completion' which may return nil or t, the new functions > > always return a string, simplifying their usage and (on account of > > the "string-*" naming) making the functionality more discoverable > > for programmers working with strings. > > > > The function `string-try-completion' provides the general case and > > is just like `try-completion' except for always returning a string. > > What is the purpose of having a separate function > `string-try-completion'? I think it is confusing if the function > respects the `completion-regexp-list' and `completion-ignore-case' > dynamic variables, and if we end up with three functions > `try-completion', `string-try-completion', and > `completions-try-completion'. > > Why not only provide a single function `string-expand-prefix' with > additional keyword or optional arguments: > > (cl-defun string-common-prefix (strings &key ignore-case regexps predicate)) > > The STRING or initial prefix argument seems redundant, since one can > always use the empty string, and use `string-prefix-p' to check a > desired prefix, or am I missing something? > > (cl-defun string-common-prefix (strings &key prefix ignore-case regexps predicate)) Adding Stefan to the discussion. From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jun 2025 14:23:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Mendler Cc: Eli Zaretskii , Stefan Monnier , 78719@debbugs.gnu.org, Drew Adams , juri@linkov.net Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174939253914417 (code B ref 78719); Sun, 08 Jun 2025 14:23:03 +0000 Received: (at 78719) by debbugs.gnu.org; 8 Jun 2025 14:22:19 +0000 Received: from localhost ([127.0.0.1]:52475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOGug-0003kS-Qa for submit@debbugs.gnu.org; Sun, 08 Jun 2025 10:22:19 -0400 Received: from smtp-1.orcon.net.nz ([60.234.4.34]:51779) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOGuc-0003kD-ML for 78719@debbugs.gnu.org; Sun, 08 Jun 2025 10:22:15 -0400 Received: from [10.253.37.70] (port=64343 helo=webmail.orcon.net.nz) by smtp-1.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1uOGuX-0003Hd-4N; Mon, 09 Jun 2025 02:22:09 +1200 Received: from ip-115-69-187-4.as55850.net ([115.69.187.4]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Mon, 09 Jun 2025 02:22:09 +1200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 09 Jun 2025 02:22:09 +1200 From: Phil Sainty In-Reply-To: <87wm9mh19b.fsf@daniel-mendler.de> References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> Message-ID: X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-06-09 00:21, Daniel Mendler wrote: > What is the purpose of having a separate function > `string-try-completion'? The purpose was just to keep `string-common-prefix' as simple as possible without people then needing to go back to `try-completion' if they wanted the more complicated features. > (cl-defun string-common-prefix (strings &key prefix ignore-case > regexps predicate)) Yes, offhand that seems fine as well. I don't think I have a preference. -Phil From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jun 2025 14:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Phil Sainty Cc: Eli Zaretskii , Stefan Monnier , 78719@debbugs.gnu.org, Drew Adams , juri@linkov.net Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174939328516520 (code B ref 78719); Sun, 08 Jun 2025 14:35:01 +0000 Received: (at 78719) by debbugs.gnu.org; 8 Jun 2025 14:34:45 +0000 Received: from localhost ([127.0.0.1]:52488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOH6j-0004IO-C2 for submit@debbugs.gnu.org; Sun, 08 Jun 2025 10:34:45 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:53959 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOH6d-0004I1-HZ for 78719@debbugs.gnu.org; Sun, 08 Jun 2025 10:34:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=83ChLY5px9Ccf8kTuSJJ6HGNMuctWurQMe1NUpiAXdg=; b=UmzKJ/fMJRAb6Yy9u2KH/q3+Mm CaaeyqbOZoc6DnzIVBnZFLu/uRMAnFdA/5dp3RXd0lezMIstYgFVg4Dttta2WYi1jSl1I6bZ3yviq EJRsAQDi9mfO8EponRVBXh7eVHtEwhpHZ9D3P2mAFjRkiWC2CFDaoDy0ezA5HRgqapKI=; From: Daniel Mendler In-Reply-To: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> Date: Sun, 08 Jun 2025 16:34:30 +0200 Message-ID: <87tt4qgv49.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Phil Sainty writes: > On 2025-06-09 00:21, Daniel Mendler wrote: >> What is the purpose of having a separate function >> `string-try-completion'? > > The purpose was just to keep `string-common-prefix' as simple as > possible without people then needing to go back to `try-completion' > if they wanted the more complicated features. Okay, but for more features people can always fall back to `try-completion'. What I find problematic are the dynamic variables `completion-regexp-list' and `completion-ignore-case'. They should rather be passed as arguments, such that the function is self-contained and decoupled from the completion variables. >> (cl-defun string-common-prefix (strings &key prefix ignore-case >> regexps predicate)) > > Yes, offhand that seems fine as well. > > I don't think I have a preference. If this works for you, I think it is better to go with a single function instead of adding multiple new variants of rarely used functions. > -Phil From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jun 2025 23:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Mendler , Phil Sainty Cc: Eli Zaretskii , "78719@debbugs.gnu.org" <78719@debbugs.gnu.org>, Stefan Monnier , "juri@linkov.net" Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174942547515462 (code B ref 78719); Sun, 08 Jun 2025 23:32:02 +0000 Received: (at 78719) by debbugs.gnu.org; 8 Jun 2025 23:31:15 +0000 Received: from localhost ([127.0.0.1]:53236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOPTv-00041K-1O for submit@debbugs.gnu.org; Sun, 08 Jun 2025 19:31:15 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:49402) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOPTr-00041A-6y for 78719@debbugs.gnu.org; Sun, 08 Jun 2025 19:31:12 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 558Kdq7A020780; Sun, 8 Jun 2025 23:31:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=4d28ABigaN8JIHTh3VLJMT/dmmjt3nZuULPdex3tWJ0=; b= PMmERbi8uozHxve1lbjqaLQrxvHx2R1wjBeipY7hXSEeJQLpc00pCyZoWGA0vKE1 +Whckgw7IdjV4aBx6R5zrU4gV0X3ZQQCnamvbqrtiwGK2rXjjs7IYXaHRDKZO9lD kUUaz/GwRq5cEES0mQJ6h9sJPYFjiMisfgl52aQ+WL/YRwZGmRPXRaWpvTlZ6R20 rzqfWLNNpubGSUTD80ott80JTlpM7iNCxVi19Xvg/dlznHKwP0POOVkmbnX7OELW i8VgzS6kXvV6vmB5ce7cs5F5Uckmi8FdsGlN4mc/ZXHHFf4JcjXzEqYpG57jEFMN GbYJPFk1bZYWeKKBbLhIbA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 474c1498yd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 08 Jun 2025 23:31:04 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 558Mcu8H003279; Sun, 8 Jun 2025 23:31:03 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 474bv6um69-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 08 Jun 2025 23:31:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MmCuiMdt6BqHgp3hocvTghS8Fxg4YOK9Bsv8RqjD2eM4rNw5IK09LQQI3Ol180FMjm75U0zhXzCAYw/Jim2GTTJLpBsBKS0IXJadPmAxi2KzJ4PwX61/xDJNl4pRIzl5qv+wxEn2Hl4Ky3J5rTpVP5criXefgHGuygMlHcm1uf6yAEiARTET1Ti8uqEHjlti59mhUI47D71Po7ENkEPFbFQRG9kedM65XZM3bl427T+QgNffqwTAbFUAr/VRbVhAUifk3wCxrGDYgqyiOqGFRly7mmSGicUzQgquXlAa59iO1yjWViaUJobGY10it/xWYDRr2QTZ5LMseJ68ffp8+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4d28ABigaN8JIHTh3VLJMT/dmmjt3nZuULPdex3tWJ0=; b=tBKyKz3hEwoUtyGVh2v9VjvUdcsj77sg0V1A3yXgkOq3qNmiQehiB9j1DUX6hoZkRZzuZoorz2uCbayln2jXJPc4E7yK0zq5jI1diC+Jxjo1Yq5JLTeJGgt6U4miypAcRvUcA6vwLYJkLQhFiPxz5V301LANP5ivb9L0IGTC4YxNlZjDpwyYFWE6k88B4Lpn17YqoXHI7Njpc4ePA4kgCByO+63L0g4nBaSzP1DKdPdSt/RVBS+VabdkMXEjRi1AI2RffdLB5I38TF2/mwvU0nPx259w0zXO9r5QhSTk9Up2SmVqxnAEdxpAkaZvu0RfH3Y8s8B7ZFy0pHemKyut0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4d28ABigaN8JIHTh3VLJMT/dmmjt3nZuULPdex3tWJ0=; b=RHnBgADPzYyS2TZnXeGM3X73xUUxkgR7p8F2IVJvCZNTEgeuHGolDlv/BzSwEcEe6csJUMY2gWonj9O+QmhAOLH3myAA2ypk0L3UvWB/ABC9fg4ftypInDQ6dE2KTguX3IZ2ko2rQysoSI95NzqwfI1KWrcVqWjAMar47y+FJmY= Received: from DS7PR10MB5232.namprd10.prod.outlook.com (2603:10b6:5:3aa::24) by PH7PR10MB6484.namprd10.prod.outlook.com (2603:10b6:510:1ef::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.29; Sun, 8 Jun 2025 23:31:00 +0000 Received: from DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324]) by DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324%7]) with mapi id 15.20.8813.021; Sun, 8 Jun 2025 23:30:59 +0000 From: Drew Adams Thread-Topic: [External] : Re: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Thread-Index: AQHb2IJ7B5u4k6Pv4UOWoEUnFbgKBLP55ZBw Date: Sun, 8 Jun 2025 23:30:59 +0000 Message-ID: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87tt4qgv49.fsf@daniel-mendler.de> In-Reply-To: <87tt4qgv49.fsf@daniel-mendler.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS7PR10MB5232:EE_|PH7PR10MB6484:EE_ x-ms-office365-filtering-correlation-id: 59feacb6-6229-48cc-c288-08dda6e486ad x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: WsiUT6eNj1A4DAvnc10IdpesfFQe2WUsYQNDcMXBvRUjiH38WkJMynuBttTy1hTsfRRO0XqxV5T94vEyFFMxAroM0Fyp7/cqX5KgRmVuf9euO1LuLO3yYcdqU6HU7DYymp3rxIYyexTV+2Bcr3f3dl3sAx/W0zTWXSdlj5ShGy6V+7Fr4zAA9LMoGS7gp5TGs+L/usnmDIDyHi0Z5eWhMCsEhS+HGSo3/uUjXqMsVk8XMRAbmfnXObPxQi5++S0WSAWSy6AbQVw0GRUApP9yUx/2yh0q/jiU/SkSgaM3XcMbD2lFLG4kAlkoMD1HRbUezUi1TbnHkRgehFuFMZFjdIELLPvKOaOhp2RXXxDVXPU+q3+h/2w+VesruoP3p+Hb7+2Bcsw2Ef1bbFFXAv9vE6Y5eRHZ8/npa/FGrbkg6h4bitbex82P8atD5d5w6LutQk9LKoEy7HekIA5HKpb8avFXYXzWwZTJEvWUmczL3M8VVHG6/3uMUHxYipy17twJy+wP65bCK8CV/dkBM723vTB/U/4PSoihZ4YbB4HmaPEpiJxlzLMTGfHa5bJ2hgxGm/0uls5fEOpF1XJ5rqrFenwqvFS/u4m2+b4m6/t6ebUEEIWb5cNrDDxjHWg44VxllHTQy9EFSl28fBrofEce96FP0/wRSKMnhKt81UyWbN2ItVX01oU/DoNT16JrZxsudaT2MG+u6EHhTsekru6l+Lw/lXn+WPgZP8OehhJWce/9L5sWOwHGQsBrStQebXdO/1PjQs4qHZGrB2PpAjZeSmg9txEW67LvHBsWczI/U++fjrkBO4KutrlWqiRs4FoM3f4JTOlqhty2vUyOpt9I1g9gU5MoQtd+ff7QOzRXK6dltApcyV00I2m3xxgQUt1H1DRe0LpPvsYPsGEJnkitF/8ac/fH7QDgyw1AkhLMn6XLvsrbnF127qx+3inWkwuTXzqtDVdK/CIRS4HxvoJHOwNZFkwaRkyN02dby2/9xvVMswFonVh9lH6xaZuqdThQ+DMIv/V8CKZ6VWC7P6vZ9Nq+CTNjQsepdOzv8QuuVl09NrvHEXZcDuYzMsrpCQp94OJKm3/eiRvxkthEDTv0fa+YmL6jXUizYyPsLJdcO9v/n45yGcd3Pk0Eb6eOZdweyyEzDXpYB+sfinDnwvO/Eg/IZjW3S8lOtIlLwgM/eiIzgY9HL9RefTyDSZSs5NXf3H4TJwL+9e4301LuxZHOAtif5pvgkCq1tvkMDMC1mDngGqVCSLI7IyWul1snu0yluZQGJeN1pCaI+U0CBJJ67Ke/EwSaI3vn7/Nau7nLnG22cAxDOJflBAZWtrtpinWRH6Fm/82XCQmAEcdsj7NbGuOjnJi2Hu9xR5IjgRE5+FT0g8J/eLkK6fF5q8O7QlZosWRlTJfEt9XMumakeSYxndMGN3obIP+eLVpR82TxolgCIHqsMGKhkteTIXu3RWeWKirBZu8A5G8F6DMw9FDd6K1M0hVr3AfeyT/OqDgsTNI= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5232.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: WRQhvOQs595IRDJoYJZHFdE+ty6ay6a2dZOw6yGfMnvCHpT8nlzG192cF5kVw2rtXuk8Kqj94Y29uk3R4n4VQDtb+fDQrcHV6C2GlPRZjN/XbhS8mj56czFRrRIUZvyoz9Fc+rjSbpkIiP4+az5j30rVTgos9eoDwNbADc1VsFCOm64uaZWEiKZF1iSMV52+R/o40uiNkfzeAqbvOAmTx7g6d/55OBKI/o3M0KZ0ZukTG15XVU7MAomsandkwn6FDo1TpDk1JWGzl8a8QtO3w1IXnmyYwqfcVomYJL9DtQbGw/436TqxW8tk6L977cK3kcsEf5ycQmxLqEGXgVYq+Tz7t0Ac6TwWtHzfr+FhtjisUQ1Oqx8evy/9oCtkLa3tkyEHASFI6Ci2+8+/7JPx1XsvNJICuy9i2DzwbAr/hsxAmHaKV110hD6//IuZI67+zMwZtQcVkoLk++7Fj/v646/NQ7kpkDB0d1/C37jjQNYG0Qh1wzTzd/UXD723A7T8czsFIi72/beH/wWIXQhwujjRj4EMDkOGcslE1cA0Qoq3CLwMmez5ncmuN7Zt1ebCKh28/WHi+5QWXs32HmhPi7ewU43wTaw4kx6XnWNenmlPBChRzHQ/iJe0gc4pUBZcMK/Vx0K1YePLkAeLvQ6+dYqF7UQZRHU9GMgDVm3soutZ7F/Ba0noJbt9b2gUJPx96L3S3As0TU0oHWbCboeFqhDUC3pzT43fyp9yYSaY1+QyC3Xzt8hWvdq1qJYCAcf8fqSZ8UbYXVRaN6HBesVGhwWGJI2d4DVIhwd/QHXPvop4OlvJLIU17nASp/eIt6VfsxRM0GMo+/C4v+6LA0JHZXbP1EZVp/otNw2v2PtUYnjNKp32yafmpgyJ5wRVyEufRwjB47jOh3gYpJHHXN1Ds7qHyEFrk7u8DGxK1S390VU+sQMYLeFrNEqKyKsbKHK01l1m9oNJLmpJtGGlZ3dle2/v4al0rUhEDS/825xdgsPUB1gY4NDUet/q96zW+j1LC01gcOeNrBWUxk0rO5EyMxCceLn2Owq0tLvmLJ9/0fkjQyJCfFuICQBKwNf3PNMjfQfPILwM/b8ZHNSzzYdYmXVsR5ikqTcO3sbJXmCr3mSeb/7DwSVuX21nTuwFezkKRxMM2/rH2FSeQpZ6vTwzFi8d2F+Ekfip5hsZYzoywVQ9HJH5a50vcB0Cmbw+4iPextZ2wsBlaBnjHSYbLnaOmekQq+U/UuSBYrpwEORMSoKjUmwnzBbI1tdBcB78Qu6ZT4gEfe8v06TN8JTNwyOrtf/50SpQreSN+zBCNK/NBMmip6PTjR5a2IIrvNgi6JKlxb9LERYx9HBiD919SqrhgvKsdgJ1zd4psy7Ve3WlNcueEhh19H3b4uPjorybYcMotizaSSBrraj+9ccojePaYC2ClANAoV+xofJB0nr/kLThmEYhLsZA9jOgC9x3S7I/eKmT0rT0j2BNLG4dmj2abNhom3OH9BRZqgEGZD0UF3t6wOsIWVAN1w8T9dMxMHMGavP/at2+LIWeUJOfgJVZ+JcWgzEzCjQzm2xNl47JybddciGRsjl+QAWtWk/HcOxb Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tSPZVAJKgDRKtCGUNVZ6GGMSwWoYur261TBNlC4aK/cevgypgjgZlnv8DGhqseNuwPhDpASsHY7rPmjBv55/ScW0NkMu/oT5Eq9ZSKbrgTz5x+b3AEonNA+leUMETq4SJeoWZJYKQNwfEaB09HU3YEYnRMr8V2V1d5I77HdWQKeMIneokaYGRDkXzJIraCcQQ63p7NqOXV0c2GA4Uaqgu5lcMYD6fcYY7DrGqsPDFz7W0gZHFuW4jJE4f93WJrlSPBPfMuhb2YmKT/kGuC25STpJjmUE8OP3bY9cHJHuF9yF+a7VBH40SXI49I59o/Xx6xW6SdUOfE1n6R765+AkUxxiQNEiOxoIwmNE5nUweq4qfymc0Q97VDAyl+fPG53HMb7iGxu9KrDYiXZwnh460UKbA6WR6awm1eH8R5fCWVVQCqqeSJ5sv2vRBjs1Fo3iGTK1m/DdQNigAUXRlocCe/wA220qELrIQnrlc/282AbYUhzmyauP/M/nM9Xoz0JrUqWn8WvbRVPyzhUIPE7mCXIpZie7A+131RtI2KJjqpZQoQgI5yRRpqm40ogk2Wgw96XP0uzHEi1J+67cVr/H17O1Hz0ew2G9Om7x87oSc5k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5232.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59feacb6-6229-48cc-c288-08dda6e486ad X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2025 23:30:59.8223 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: B8ZZPy7oAlemZm0BrksfIc/muB9ujJKLJDL6q/o7lDaGNN0QCLp9Ot3FjNMdFicfshn8eGv5FRomqOZ45rZhjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6484 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-08_05,2025-06-05_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2506080192 X-Proofpoint-GUID: _YBvUPvb16BOQ1pyMPf6CHJWdGdft8Fa X-Authority-Analysis: v=2.4 cv=GcEXnRXL c=1 sm=1 tr=0 ts=68461d38 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=6IFa9wvqVegA:10 a=GoEa3M9JfhUA:10 a=W8vGuGGEViEqWTaiTFIA:9 a=CjuIK1q_8ugA:10 cc=ntf awl=host:14714 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjA4MDE5MiBTYWx0ZWRfX05BCOGgNI/9R cxBIBLBSmPSECHYP3JazG6XkxUYl3NPBTYEBzKxLdfoR1/6IBCisxCo48H8QyUQw39u5tq4wukd HAOiBDY8Drvl/7KQx9nvJZ8qjY9tbNpYvLUNzJeDS75nvpxDUEo8FjFgLVTYg+mqsgj9cBmYgXO 6kiDQEPCwzxt0DhK781ZsHx/bLs0RGCT8rdYpp6fuk55cPMDn+ks+uSdnkZ3dEoPSEBgAkjnrw1 YuAqN63AHq1XkOKWhkhCZ+NzirhaTRL/jjo6FvVTDs261eFRU1HYRDAEfgB2BFpDxzmtZQGqW2k nK8sH2tBVNxMifJCHfGbqhzgmgYN8oMgHbmuV60y0LxFnL4Jng6jArqt0YEmYsmWV1c10jTuEa1 s1jyJL0f06//yu0Z6dRFGcGdbLccwUlpxfdqivqi8ap4VFMYpk0jECEnoWP7N+MUil4B63W9 X-Proofpoint-ORIG-GUID: _YBvUPvb16BOQ1pyMPf6CHJWdGdft8Fa X-Spam-Score: -1.7 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) > >> What is the purpose of having a separate function > >> `string-try-completion'? > > > > The purpose was just to keep `string-common-prefix' as simple as > > possible without people then needing to go back to `try-completion' > > if they wanted the more complicated features. >=20 > Okay, but for more features people can always fall back to > `try-completion'. What I find problematic are the dynamic variables > `completion-regexp-list' and `completion-ignore-case'. They should > rather be passed as arguments, such that the function is self-contained > and decoupled from the completion variables. >=20 > >> (cl-defun string-common-prefix (strings &key prefix ignore-case > >> regexps predicate)) > > > > Yes, offhand that seems fine as well. > > > > I don't think I have a preference. >=20 > If this works for you, I think it is better to go with a single function > instead of adding multiple new variants of rarely used functions. This all sounds good to me. ___ FWIW (very minor) - I agree it's good to have a function that always returns a string, and "" is the right thing to return for that. But for testing purposes, i.e., if you want to do something different when there's no common prefix, you have to test using `string-empty-p'. If nil were returned, you could just test with `null'/`not'. From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Jun 2025 10:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Mendler Cc: Phil Sainty , eliz@gnu.org, 78719@debbugs.gnu.org, drew.adams@oracle.com, juri@linkov.net Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.17494661093426 (code B ref 78719); Mon, 09 Jun 2025 10:49:01 +0000 Received: (at 78719) by debbugs.gnu.org; 9 Jun 2025 10:48:29 +0000 Received: from localhost ([127.0.0.1]:54038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOa3J-0000tC-8p for submit@debbugs.gnu.org; Mon, 09 Jun 2025 06:48:29 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12727) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOa3I-0000sx-5Y for 78719@debbugs.gnu.org; Mon, 09 Jun 2025 06:48:28 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id ED60D440924; Mon, 9 Jun 2025 06:48:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1749466096; bh=udbVkiML/8maAJXdk2n7/r6MwIKPA/wY6T6JccBXp+g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=R7et49atOv5dziIc6UdC4CUSrPKownEqKySN1+8dq6hjMmIIVyhl5wjbDeMEiNWOB wYTB0SxbQkBJKuny8SX99iVJixpZJsvcOQR2QJ7ZX2rTdU60jW397AV/pqZAcJHMJv H52N9qlr+ZiolJkrFUCABEx92lswpMWgcSGF3VFYhInixxBlbJBXBKVpNfPHXQy5Q5 qImWRQpKomDqVVDw5Yw4ohQKqcelB2l8q4Xv2cYdP74JRS+NnEXd7aB5StVsj+eaED 6KFcWss4+6FXRenLTS388nyMsPRTnvRdPZxpFchhmgmpve657q3JDBjqwcIXsiZ+0y usHZWUnfBoWvA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 71E414400EC; Mon, 9 Jun 2025 06:48:16 -0400 (EDT) Received: from asado (unknown [130.159.222.66]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8B8A9120099; Mon, 9 Jun 2025 06:48:14 -0400 (EDT) From: Stefan Monnier In-Reply-To: <87wm9mh19b.fsf@daniel-mendler.de> Message-ID: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> Date: Mon, 09 Jun 2025 06:48:11 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I think it is confusing if the function respects the > `completion-regexp-list' and `completion-ignore-case' dynamic > variables, Strong agreement, here. It's arguably already a problem to use those dynbound variables in `try-completion`, so it's even worse here for a function which wants to be unrelated to completion. > and if we end up with three functions > `try-completion', `string-try-completion', and > `completions-try-completion'. > > Why not only provide a single function `string-expand-prefix' with > additional keyword or optional arguments: > > (cl-defun string-common-prefix (strings &key ignore-case regexps predicate)) The "try completion" part of the name sounds like it's motivated by the historical accident of how we got to it, so if we want to help those who're not familiar with (or thinking about) completion, a name like `string-common-prefix` sounds better, indeed. Do we have reasons to believe callers will want/need those `&key` arguments? My gut tells me we don't need the `predicate` and `regexps` options. > (cl-defun string-common-prefix (strings &key prefix ignore-case regexps predicate)) At this point, you might as well call `try-completion`. Stefan From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Jun 2025 10:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: Phil Sainty , eliz@gnu.org, 78719@debbugs.gnu.org, drew.adams@oracle.com, juri@linkov.net Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.17494666134939 (code B ref 78719); Mon, 09 Jun 2025 10:57:02 +0000 Received: (at 78719) by debbugs.gnu.org; 9 Jun 2025 10:56:53 +0000 Received: from localhost ([127.0.0.1]:54064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOaBR-0001Ha-0U for submit@debbugs.gnu.org; Mon, 09 Jun 2025 06:56:53 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:33957 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOaBP-0001HO-I2 for 78719@debbugs.gnu.org; Mon, 09 Jun 2025 06:56:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yk4FPBFxUDoaXmeekgiF5A1JvEV3/xE1GZ5gr+IyQmY=; b=G6MJKP8EoWjwdzGpAYujbHD3zz Lw34xdbE67fj73mzREsvgh9hUPS+EgDSEfet+LT+ZW5VZ4v/9Tv8WxaAmAi29pQmnxtE5WsLuAx8i 82I5q9RFyUljCr+fwAgfJCFXLwQvD4W6yJXp9k3tSKYghzejPPA/rPH4fGJ8hKVqrHM4=; From: Daniel Mendler In-Reply-To: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> Date: Mon, 09 Jun 2025 12:56:42 +0200 Message-ID: <87ldq141zp.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Monnier writes: >> I think it is confusing if the function respects the >> `completion-regexp-list' and `completion-ignore-case' dynamic >> variables, > > Strong agreement, here. It's arguably already a problem to use those > dynbound variables in `try-completion`, so it's even worse here for > a function which wants to be unrelated to completion. Yes, exactly. I always wondered why these variables are dynamic, since I think of them as additional arguments to `try-completion' and `all-completions'. Historical reasons? Would it make sense to change their calling convention, or do you feel that such a change would be too intrusive? Probably it is not worth the effort. But in any case, we should avoid the mistake for the new function in the string namespace. >> and if we end up with three functions >> `try-completion', `string-try-completion', and >> `completions-try-completion'. >> >> Why not only provide a single function `string-expand-prefix' with >> additional keyword or optional arguments: >> >> (cl-defun string-common-prefix (strings &key ignore-case regexps predicate)) > > The "try completion" part of the name sounds like it's motivated by the > historical accident of how we got to it, so if we want to help those > who're not familiar with (or thinking about) completion, a name like > `string-common-prefix` sounds better, indeed. +1 > Do we have reasons to believe callers will want/need those `&key` > arguments? My gut tells me we don't need the `predicate` and > `regexps` options. Yes, I think it makes sense to only offer the simplest function without additional features, since the goal is a simpler API after all to obtain common prefixes. (defun string-common-prefix (strings &key ignore-case)) If additional completion features are needed, we can refer the user to `try-completion' in the docstring or the manual. > Stefan From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jun 2025 09:31:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Mendler Cc: eliz@gnu.org, juri@linkov.net, Stefan Monnier , drew.adams@oracle.com, 78719@debbugs.gnu.org Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.1749547827658 (code B ref 78719); Tue, 10 Jun 2025 09:31:03 +0000 Received: (at 78719) by debbugs.gnu.org; 10 Jun 2025 09:30:27 +0000 Received: from localhost ([127.0.0.1]:34501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOvJG-00009M-M9 for submit@debbugs.gnu.org; Tue, 10 Jun 2025 05:30:26 -0400 Received: from smtp-2.orcon.net.nz ([60.234.4.43]:47385) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOvJA-000076-Cp for 78719@debbugs.gnu.org; Tue, 10 Jun 2025 05:30:19 -0400 Received: from [10.253.37.70] (port=39560 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1uOvIy-0004aU-SX; Tue, 10 Jun 2025 21:30:05 +1200 Received: from ip-115-69-187-4.as55850.net ([115.69.187.4]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Tue, 10 Jun 2025 21:30:04 +1200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 10 Jun 2025 21:30:04 +1200 From: Phil Sainty In-Reply-To: <87ldq141zp.fsf@daniel-mendler.de> References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87ldq141zp.fsf@daniel-mendler.de> Message-ID: X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-06-09 22:56, Daniel Mendler wrote: > Stefan Monnier writes: > > Do we have reasons to believe callers will want/need those > > `&key` arguments? My gut tells me we don't need the > > `predicate` and `regexps` options. > > Yes, I think it makes sense to only offer the simplest > function without additional features, since the goal is a > simpler API after all to obtain common prefixes. > > (defun string-common-prefix (strings &key ignore-case)) > > If additional completion features are needed, we can refer > the user to `try-completion' in the docstring or the manual. We essentially get that extra functionality for free, so I see no reason not to leverage that by supporting it in the new function. My original two-function approach was to provide that 'simplest' function while also ensuring that the extra features were still available without callers having to account for the various non-string return values from `try-completion'. So I don't like the idea of `try-completion' being the only option for someone who wants to use the extra features. I'm happy to go with the single function approach, as the cl-defun approach keeps the API simple in the simple case, but I think the extra keywords should be supported. I'm happy to implement that. Is it ok to (eval-when-compile (require 'cl-lib)) in subr.el in order to use cl-defun ? -Phil From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jun 2025 09:49:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Phil Sainty Cc: eliz@gnu.org, juri@linkov.net, Stefan Monnier , drew.adams@oracle.com, 78719@debbugs.gnu.org Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174954891011523 (code B ref 78719); Tue, 10 Jun 2025 09:49:04 +0000 Received: (at 78719) by debbugs.gnu.org; 10 Jun 2025 09:48:30 +0000 Received: from localhost ([127.0.0.1]:34528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOval-0002za-Rh for submit@debbugs.gnu.org; Tue, 10 Jun 2025 05:48:29 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:51971 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOvai-0002y2-CT for 78719@debbugs.gnu.org; Tue, 10 Jun 2025 05:48:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YAAFC9wJLevEOSo74TXmv1u/QINdb0L+CpqqYvufbiU=; b=it6P5Rt6SwZmwKsCPGeQty//VY OEyD/xrnMKPkvxAOiMpx7ComMFtYjtT5d0KLY8uH/9dWPLW+TuftsTdstDPuqh4MEkyTCNHR4s1rZ ol4C5geRJW1WgQ/J4eMRskCAApcPQuMetBL5TtREHsY/zkk0zAY0kNFbOYYQ0dGSiwqg=; From: Daniel Mendler In-Reply-To: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87ldq141zp.fsf@daniel-mendler.de> Date: Tue, 10 Jun 2025 11:48:13 +0200 Message-ID: <877c1kx6zm.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Phil Sainty writes: > On 2025-06-09 22:56, Daniel Mendler wrote: > >> Stefan Monnier writes: >> > Do we have reasons to believe callers will want/need those >> > `&key` arguments? My gut tells me we don't need the >> > `predicate` and `regexps` options. >> Yes, I think it makes sense to only offer the simplest >> function without additional features, since the goal is a >> simpler API after all to obtain common prefixes. >> (defun string-common-prefix (strings &key ignore-case)) >> If additional completion features are needed, we can refer >> the user to `try-completion' in the docstring or the manual. > > We essentially get that extra functionality for free, so I see > no reason not to leverage that by supporting it in the new > function. Additional features are not completely free. If you add complexity to a new function `string-common-prefix', it gets harder to understand and use. Given that we already have `try-completion', one can use that if one wants to use additional regular expressions. The goal is to provide a simple API to compute the common prefix of a list of strings, not to dress `try-completion' differently. Therefore my favorite function looks like this: (defun string-common-prefix (strings &key ignore-case)) > My original two-function approach was to provide that 'simplest' > function while also ensuring that the extra features were still > available without callers having to account for the various > non-string return values from `try-completion'. So I don't like > the idea of `try-completion' being the only option for someone > who wants to use the extra features. Yes, but introducing a second function `string-try-completion' with the single purpose of having a uniform string return type (and without dynamic variables) does not seem worth it. Then I would rather go with the single function. > I'm happy to go with the single function approach, as the > cl-defun approach keeps the API simple in the simple case, but > I think the extra keywords should be supported. I'm happy to > implement that. Yes, this is better than the two functions, even if I still favor the simpler function as mentioned above. > -Phil From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jun 2025 12:16:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Phil Sainty Cc: mail@daniel-mendler.de, juri@linkov.net, monnier@iro.umontreal.ca, drew.adams@oracle.com, 78719@debbugs.gnu.org Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174955775412754 (code B ref 78719); Tue, 10 Jun 2025 12:16:03 +0000 Received: (at 78719) by debbugs.gnu.org; 10 Jun 2025 12:15:54 +0000 Received: from localhost ([127.0.0.1]:36646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOxtS-0003Je-0j for submit@debbugs.gnu.org; Tue, 10 Jun 2025 08:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44222) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOxtO-0003JM-OK for 78719@debbugs.gnu.org; Tue, 10 Jun 2025 08:15:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uOxtF-0005h7-75; Tue, 10 Jun 2025 08:15:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=vgatRmCuWeoVnaG4H+UpKtzL2QEeaOw9slfm67On9HA=; b=OQALWSNexMhb NVjLRozc4Nh1ZrdWKCgEqyQeAenlwlaBgMJnCOrFyoIeVkva1jLYB11Q3+HMt8ZGhYhtclGyy4NTe aQl8SqBe+gnQoBouMCJTRAMYdNGnyHxLDtL/t6n70SJp656ykJUFUw5W1UOhffIC9AU3Y6685cObB QaYEmcfDUy3hNdkUU6y5Ry6ESp2nMMLkuelnWS+QcP8nKVul6er5INFc5vWw1UlAyPwkNPz27oGho BzCXQSYpLAdbMywlCpRp7gW+Z7IdybgMQsqYC7PAQwYl/UbBaR0lIoey8LTfv7kKwNUsKciMCvfcl l4YS4zJIOkMY0DrEdq6AeQ==; Date: Tue, 10 Jun 2025 15:15:27 +0300 Message-Id: <86bjqvg5cw.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Phil Sainty on Tue, 10 Jun 2025 21:30:04 +1200) References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87ldq141zp.fsf@daniel-mendler.de> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Tue, 10 Jun 2025 21:30:04 +1200 > From: Phil Sainty > Cc: Stefan Monnier , 78719@debbugs.gnu.org, > eliz@gnu.org, drew.adams@oracle.com, juri@linkov.net > > Is it ok to (eval-when-compile (require 'cl-lib)) in subr.el > in order to use cl-defun ? Can we please avoid that at all costs? Why do we need cl-defun here, anyway? How many arguments should these functions have? From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jun 2025 12:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Phil Sainty Cc: Daniel Mendler , eliz@gnu.org, 78719@debbugs.gnu.org, drew.adams@oracle.com, juri@linkov.net Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174955837715717 (code B ref 78719); Tue, 10 Jun 2025 12:27:02 +0000 Received: (at 78719) by debbugs.gnu.org; 10 Jun 2025 12:26:17 +0000 Received: from localhost ([127.0.0.1]:36856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOy3V-00045N-7q for submit@debbugs.gnu.org; Tue, 10 Jun 2025 08:26:17 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32360) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOy3T-00044x-3w for 78719@debbugs.gnu.org; Tue, 10 Jun 2025 08:26:15 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0F690808F6; Tue, 10 Jun 2025 08:26:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1749558368; bh=jwEtI8s79TNMU53Ze3r0maeGny1GK6GYx10hRly5+vk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=PLFhUERPoalZS5qUPBv27fU/Nf+a+fRjqoyO7YQ2cphZTtoA4YzReFwMWzFrQOm+c QaJOJF53RU8B3vC+N7Myz9PGhkpJuXeAFq0tYXk73cKsPZeQ2lq57gXzXOzGdyywfM lFrnQs28N8NxIM0bTo5rTfg1+N+iNO8RdbWGSrM0nNZbvBhty46pDwlfJV54nc1FW7 bUt1TKoQte171cSOPVBlrSnmD10iydH1LI8IuPMrCheiZGSwxlTnKs3pux8+hxbbR6 aw73iJli/Q7iUvdmOVDShWRgC2Z/jVsUBoq0T8DeCOc3pYq/XEH9spXl3u8EUOrtlD 5+ufTsb1iCKlw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4EF9480038; Tue, 10 Jun 2025 08:26:08 -0400 (EDT) Received: from asado (unknown [130.159.222.66]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6D3E51203D6; Tue, 10 Jun 2025 08:26:06 -0400 (EDT) From: Stefan Monnier In-Reply-To: Message-ID: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87ldq141zp.fsf@daniel-mendler.de> Date: Tue, 10 Jun 2025 08:26:03 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.174 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Is it ok to (eval-when-compile (require 'cl-lib)) in subr.el > in order to use cl-defun ? No, it's not. I mean, maybe there's a way to make it work, but if you "just do it", bootstrap will break because `cl-lib` needs `subr.el`. Much better to refrain from using `cl-defun`, or else move the definition to a later file, like `simple.el` or `subr-x.el`. Stefan From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jun 2025 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: Daniel Mendler , eliz@gnu.org, 78719@debbugs.gnu.org, drew.adams@oracle.com, juri@linkov.net Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174956350918412 (code B ref 78719); Tue, 10 Jun 2025 13:52:02 +0000 Received: (at 78719) by debbugs.gnu.org; 10 Jun 2025 13:51:49 +0000 Received: from localhost ([127.0.0.1]:37763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uOzOG-0004mp-Ob for submit@debbugs.gnu.org; Tue, 10 Jun 2025 09:51:49 -0400 Received: from smtp-3.orcon.net.nz ([60.234.4.44]:36425) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uOzO7-0004kv-M8 for 78719@debbugs.gnu.org; Tue, 10 Jun 2025 09:51:41 -0400 Received: from [10.253.37.70] (port=20996 helo=webmail.orcon.net.nz) by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1uOzNy-0005dq-0p; Wed, 11 Jun 2025 01:51:30 +1200 Received: from ip-115-69-187-4.as55850.net ([115.69.187.4]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 11 Jun 2025 01:51:29 +1200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 11 Jun 2025 01:51:29 +1200 From: Phil Sainty In-Reply-To: References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87ldq141zp.fsf@daniel-mendler.de> Message-ID: <293f3fe2d3d4a0a9d11e6db9d0f2a1ba@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > From: Phil Sainty >> Is it ok to (eval-when-compile (require 'cl-lib)) in subr.el >> in order to use cl-defun ? Eli Zaretskii wrote: > Can we please avoid that at all costs? and Stefan Monnier wrote: > No, it's not. I mean, maybe there's a way to make it work, but if you > "just do it", bootstrap will break because `cl-lib` needs `subr.el`. Righto. I figured the answers might well be along these lines. > Much better to refrain from using `cl-defun`, or else move the > definition to a later file, like `simple.el` or `subr-x.el`. All good. On 2025-06-11 00:15, Eli Zaretskii wrote: > Why do we need cl-defun here, anyway? How many arguments should these > functions have? There's one mandatory argument and four optional ones which can be mixed and matched without any obvious priority sequence. Daniel had used cl-defun when he suggested merging my original two functions into one, and I thought that the use of keyword args did seem like a nicer API than a regular function. It could be a regular function, though; I don't think there was anything *precluding* that. I'd probably go with this argument order if we do that: (string-common-prefix COLLECTION &optional IGNORE-CASE STRING REGEXP-LIST PREDICATE) -Phil From unknown Sun Jun 15 08:47:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78719: 30.1; [PATCH] Add functions `string-common-prefix' and `string-try-completion' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jun 2025 15:33:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Phil Sainty Cc: mail@daniel-mendler.de, juri@linkov.net, monnier@iro.umontreal.ca, drew.adams@oracle.com, 78719@debbugs.gnu.org Received: via spool by 78719-submit@debbugs.gnu.org id=B78719.174956954224091 (code B ref 78719); Tue, 10 Jun 2025 15:33:03 +0000 Received: (at 78719) by debbugs.gnu.org; 10 Jun 2025 15:32:22 +0000 Received: from localhost ([127.0.0.1]:39194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uP0xY-0006GF-Q7 for submit@debbugs.gnu.org; Tue, 10 Jun 2025 11:32:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57122) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uP0xT-0006E9-3k for 78719@debbugs.gnu.org; Tue, 10 Jun 2025 11:32:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uP0xK-0005DJ-De; Tue, 10 Jun 2025 11:32:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3FPpXOS3r3y/We+Y7M6mFqCvuvF5s7s9OzcB93ZLnfU=; b=Sk1MuatAJZhY uG249DrbyFsTKj797gCKe9iSeMphVPuDyOtgn4uqkKhf5JbGAOnot5/tjuWQWzrdHvbPipleZl/8a rqsSdtRSsITNJuETfpL8fF66XQ/51nKk7+N64ancKqmb0eqX3+BgGyMHDE2pnLtF3rBCAswglzHzd ZxeuE952xnkkPCLXpCYdVCmvZaqZW48s4nDaeEMX7G0nHEb9uC2/RP88n0V9pP8ijegB8VqEtG0Ii +waYF3LdAFFfRsJR64Zfwp/ewWY2OAHjADg76hqZfuiEAJNXu+aF+nhVrDDeK4Vhd9kwSuU4kqoy5 Ft7c52EHf2xDXQCuOCMUmQ==; Date: Tue, 10 Jun 2025 18:32:03 +0300 Message-Id: <864iwnfw98.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <293f3fe2d3d4a0a9d11e6db9d0f2a1ba@webmail.orcon.net.nz> (message from Phil Sainty on Wed, 11 Jun 2025 01:51:29 +1200) References: <670a52b1ddc8a9a97a6ce308e628235d@webmail.orcon.net.nz> <87wm9mh19b.fsf@daniel-mendler.de> <87ldq141zp.fsf@daniel-mendler.de> <293f3fe2d3d4a0a9d11e6db9d0f2a1ba@webmail.orcon.net.nz> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 11 Jun 2025 01:51:29 +1200 > From: Phil Sainty > Cc: Daniel Mendler , 78719@debbugs.gnu.org, > eliz@gnu.org, drew.adams@oracle.com, juri@linkov.net > > On 2025-06-11 00:15, Eli Zaretskii wrote: > > Why do we need cl-defun here, anyway? How many arguments should these > > functions have? > > There's one mandatory argument and four optional ones which > can be mixed and matched without any obvious priority sequence. > Daniel had used cl-defun when he suggested merging my original > two functions into one, and I thought that the use of keyword > args did seem like a nicer API than a regular function. > > It could be a regular function, though; I don't think there > was anything *precluding* that. I'd probably go with this > argument order if we do that: Then let's have a regular function. 5 arguments is not too much, IMO. > (string-common-prefix COLLECTION &optional IGNORE-CASE STRING > REGEXP-LIST PREDICATE) I think STRING should come before IGNORE-CASE. Otherwise, LGTM, thanks.