From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?Q?Simen_Heggest=C3=B8yl?= Newsgroups: gmane.emacs.devel Subject: Re: New feature in project.el: Remembering the previously used projects Date: Fri, 29 May 2020 17:54:45 +0200 Message-ID: <36815.5526042514$1590767744@news.gmane.org> References: <6f0f6cc9-52f4-8383-9827-ead54e898472@yandex.ru> <87pnan8xuf.fsf@tcd.ie> <8834c5e9-90c7-a8ad-3dcd-b8fb95f99df5@yandex.ru> <87eer3nqnd.fsf@warpmail.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="40511"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: "Basil L. Contovounesios" , "Philip K." , emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 29 17:55:44 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jehMF-000AUn-9O for ged-emacs-devel@m.gmane-mx.org; Fri, 29 May 2020 17:55:43 +0200 Original-Received: from localhost ([::1]:56568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jehME-0001Nj-Bu for ged-emacs-devel@m.gmane-mx.org; Fri, 29 May 2020 11:55:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jehLT-0000Qc-9W for emacs-devel@gnu.org; Fri, 29 May 2020 11:54:55 -0400 Original-Received: from aibo.runbox.com ([91.220.196.211]:56008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jehLR-0004bW-4W for emacs-devel@gnu.org; Fri, 29 May 2020 11:54:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Type:MIME-Version:Message-ID:Date:References:Subject: Cc:To:From; bh=OUE4dxYyw8F62VYeB7k3hb3iBFr1EBB79pSSEnq0zO4=; b=DaMGyJAyGbp3Xq aOhp5oqJY2bhbFalMkPuQITm2X0akbADAV+t95/haqwM9SeoACyiM++ndzAOp7muXEjQHqamS+Umo DIrKpKlMlZ2Lq1KrNPer1FKRB285pfV2dQuE/1rdELE3DCTKBJt8vkVUjkKJyMWVoYpHEX1XOvopL YJA/LSQztmyGPXep4a3ybd76i+q+gj3K87PR3Ry/LdG0mpzpuVXGRoVsEfx2xtNJtaqBiGSLjka8m 0TtDDLgY8X44DJNK91ZXzwT+z972gsm/nmRhXLhpXofuOx1Y9Oq9Jw4CtHWBldNkbdDWFvB0sD9bJ y1pVPrz9+K1jSBUZkV3g==; Original-Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1jehLL-0008P0-LM; Fri, 29 May 2020 17:54:47 +0200 Original-Received: by submission01.runbox with esmtpsa [Authenticated alias (963757)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1jehLJ-0006bQ-Q0; Fri, 29 May 2020 17:54:45 +0200 Received-SPF: pass client-ip=91.220.196.211; envelope-from=simenheg@runbox.com; helo=aibo.runbox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/29 11:54:48 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, MSGID_MULTIPLE_AT=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251624 Archived-At: --=-=-= Content-Type: text/plain Hi Basil and Philip, thanks for checking it out! Dmitry Gutov writes: > On 29.05.2020 02:05, Basil L. Contovounesios wrote: > >> Can the project-list file name please be customisable? > > Of course. Just an omission. Yup. "Basil L. Contovounesios" writes: > Could the contents of the project-list file comprise easily readable, > printable, and even extensible sexps? I guess it could, but do you have any immediate use case in mind, or were you thinking about easier forward compatibility in general? I modeled the current approach after org-agenda-files, thinking that the scheme with one project directory per line would be the easiest to edit by hand. > In fact, couldn't project--ensure-file-exists be eliminated altogether? > If the file doesn't exist, just don't set project--list, or set it to > nil. Sounds good to me. How about the attached? > Could project-switch-project reuse read-multiple-choice or similar? There's definitely an advantage to reusing a function like that, especially since it provides a more unified interface for the users. I tested it with Philip's patch, but I have to agree with Dmitry in that I prefer the current interface where the key choices are presented in brackets next to the labels. I find it much easier to read the choices at a glance compared to when the keys are made bold in midst of the label texts. Also the "Find regexp" choice doesn't have an "s" in it, so in that case read-multiple-choice puts the "s" in brackets instead, making it non-uniform with the layout of the other choices. The current approach where button choices are kept apart from the labels is inspired by the Org Export Dispatcher and Magit's many menus, which I think are excellent interfaces. If it turns out that more people, like Dmitry and myself, like this approach better, maybe read-multiple-choice's layout could be changed? "Philip K." writes: > I think it can be improved by adding a "case-insenstive" option to > read-multiple-choice, because for example currently it seems to > highlight the second "f" in "Find file" > ^ > this one here ____________| Hm, won't that be a problem when the user wants to use the lower and upper variants of the same character for different commands? That's done extensively in Org Mode's Export Dispatcher for instance. The bracketed layout approach has natural support for it however: [f] Find foo [F] Find bar -- Simen --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Remove-project-ensure-file-exists.patch >From 4cb6cbb3776f142050cd70de279294cf98c63969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Fri, 29 May 2020 16:58:09 +0200 Subject: [PATCH] Remove 'project--ensure-file-exists' * lisp/progmodes/project.el (project--ensure-file-exists): Remove. (project--read-project-list): Set 'project--list' to nil when the project list file doesn't exist. --- lisp/progmodes/project.el | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 92293d0e2d..56087a7290 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -718,25 +718,20 @@ project-compile (defvar project--list 'unset "List of known project directories.") -(defun project--ensure-file-exists (filename) - "Create an empty file FILENAME if it doesn't exist." - (unless (file-exists-p filename) - (with-temp-buffer - (write-file filename)))) - (defun project--read-project-list () "Initialize `project--list' from the project list file." (let ((filename (locate-user-emacs-file "project-list"))) - (project--ensure-file-exists filename) - (with-temp-buffer - (insert-file-contents filename) - (let ((dirs (split-string (buffer-string) "\n" t)) - (project-list '())) - (dolist (dir dirs) - (cl-pushnew (file-name-as-directory dir) - project-list - :test #'equal)) - (setq project--list (reverse project-list)))))) + (setq project--list + (when (file-exists-p filename) + (with-temp-buffer + (insert-file-contents filename) + (let ((dirs (split-string (buffer-string) "\n" t)) + (project-list '())) + (dolist (dir dirs) + (cl-pushnew (file-name-as-directory dir) + project-list + :test #'equal)) + (reverse project-list))))))) (defun project--ensure-read-project-list () "Initialize `project--list' if it hasn't already been." -- 2.26.2 --=-=-=--