From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#42210: bug#41890: 28.0.50; [PATCH]: Add bindings for project.el Date: Sat, 25 Jul 2020 01:54:20 +0300 Message-ID: <9e7c9ce3-5f1a-fcfd-c87e-8e549cf4f580@yandex.ru> References: <87mu50b43d.fsf@warpmail.net> <87pn92t1ye.fsf@iris.silentflame.com> <874kqcsnu5.fsf@iris.silentflame.com> <54a1ed24-9d0e-4671-eb70-9d8c253e7aac@yandex.ru> <87y2ngg64e.fsf@iris.silentflame.com> <99e82681-e645-2888-3d24-26698ee0c7e0@yandex.ru> <871rl6gmip.fsf@iris.silentflame.com> <874kq1d7wf.fsf@iris.silentflame.com> <87zh7s8mlv.fsf@mail.linkov.net> <87blk849lh.fsf@iris.silentflame.com> <87tuxz2vt8.fsf@iris.silentflame.com> <1d2621fe-2e06-cc2d-3c3f-b44d61427ac2@yandex.ru> <878sf9u0rm.fsf@iris.silentflame.com> <83sgdhe9jc.fsf@gnu.org> <871rl1t0aa.fsf@iris.silentflame.com> <83ft9gevt4.fsf@gnu.org> <87wo2swqx0.fsf@iris.silentflame.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------DF21B87F1071D9272AAA3A5E" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39756"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: contovob@tcd.ie, 41890@debbugs.gnu.org, philip@warpmail.net, 42210@debbugs.gnu.org, juri@linkov.net To: Sean Whitton , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 25 00:55:15 2020 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 1jz6ax-000AD5-DU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Jul 2020 00:55:15 +0200 Original-Received: from localhost ([::1]:54940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jz6av-0005zb-VQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Jul 2020 18:55:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jz6ak-0005zH-BW for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2020 18:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jz6ak-0004eg-2a for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2020 18:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jz6ak-0001Kh-1v for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2020 18:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jul 2020 22:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42210 X-GNU-PR-Package: emacs Original-Received: via spool by 42210-submit@debbugs.gnu.org id=B42210.15956312745070 (code B ref 42210); Fri, 24 Jul 2020 22:55:02 +0000 Original-Received: (at 42210) by debbugs.gnu.org; 24 Jul 2020 22:54:34 +0000 Original-Received: from localhost ([127.0.0.1]:48920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jz6aH-0001Jh-UJ for submit@debbugs.gnu.org; Fri, 24 Jul 2020 18:54:34 -0400 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:45028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jz6aE-0001JP-CM; Fri, 24 Jul 2020 18:54:32 -0400 Original-Received: by mail-wr1-f47.google.com with SMTP id b6so9602685wrs.11; Fri, 24 Jul 2020 15:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=1YS9bHxz6jQaO40wFhUqfodd5s6nEQ77xrf6eFqiA2A=; b=PumJ/Jj00OYdb72yasL346AgB+bmgSTfH8odkAz5AlmAt35WOGq4BF9PqegmOYYAeP AK0qrCEvdqLSWP5pK/0MPdipIs+M315RJBA2i1w7CBEAmoVq+05Q9BaC2PkTds4a8WpE 1FimEwg+JNcOUKNrv/IdLEn9p7p0+1dNjAvvU8n6wVCItoXm45BUfWBglNVdtZiBrEMY HwLS7Y8sALQSloHVbj1wkRzEmeDjiS/+Why+RTrKcscBFPd3guge6tlO0SGgyAHnwvUm iSTYdk5G2ZYDGqEJwD/8SeDzMB7uXMTO1I6gtlKL79a9rReAcxZW39OyiVEQoK5k7K/U 2pwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=1YS9bHxz6jQaO40wFhUqfodd5s6nEQ77xrf6eFqiA2A=; b=RqeJS/t+FdO6xiDZKQLJ2HA/OePWJmmbb7OjpPvW+iI7tUFn96ov93h/K+Hm7yQwG9 9IumMbvf+1cppuSB/kvCLTmhjEFDdJygvj5NdEy4RBT7eo2ymExGeLeovnCTIt2Eo4AE b0D3uyw8yPydo0Z/zOSypdbJfPuqrN7docIlDReCmMYJgryByvCaPYtZk7w6Q40HbLrx /ae5deLPeKYwEGd2UB2cpNUf6jEPWs4v3sgGwlkd9IAT34Iwrr8/JYhVuDGLdudkUtMj 7OlTMy3CKOn3HVr8LKtLgWrb1rMuB5WIsbQvkTrbsL2NRefBc5BGKNR+S4bpXiWy9obr wUIA== X-Gm-Message-State: AOAM532+JEVGH88Nk57erlZ62v9Mb6PXt4IkVLkFcdFGyOKu4JS7FVpw QVxJiH+w43+UgXQ7PiVanh8= X-Google-Smtp-Source: ABdhPJzLkfbuJ9G7GBX0LWyoQMRKAlP1IYpeHEYuqqgYd2FgC853mfCN8caEs8doXCW2Lo6OBvpqjw== X-Received: by 2002:adf:ea0f:: with SMTP id q15mr10136637wrm.113.1595631264284; Fri, 24 Jul 2020 15:54:24 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id q4sm8787186wme.31.2020.07.24.15.54.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jul 2020 15:54:23 -0700 (PDT) In-Reply-To: <87wo2swqx0.fsf@iris.silentflame.com> Content-Language: en-US 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" Xref: news.gmane.io gmane.emacs.bugs:183510 Archived-At: This is a multi-part message in MIME format. --------------DF21B87F1071D9272AAA3A5E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Sean, On 25.07.2020 00:20, Sean Whitton wrote: > Okay, then I think the attached addresses feedback received. Thanks! These are good patches, working well. But here's a change on top of yours that simplified things a little, and makes a few things unnecessary (I think). All by using the variable called switch-to-buffer-obey-display-actions. What do you and others think? I'll easily admit to being out of my depth when it comes to window management, so if there are reasons to go with the full-on approach, no objections from me. --------------DF21B87F1071D9272AAA3A5E Content-Type: text/x-patch; charset=UTF-8; name="project-other-place-shorter.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="project-other-place-shorter.diff" diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7a0bf1fdbf..2cad66e705 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -592,29 +592,12 @@ project-prefix-map ;;;###autoload (define-key ctl-x-map "p" project-prefix-map) -;; We can't have these place-specific maps inherit from -;; project-prefix-map because project--other-place-command needs to -;; know which map the key binding came from, as if it came from one of -;; these maps, we don't want to set display-buffer-overriding-action - -(defvar project-other-window-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-o" #'project-display-buffer) - map) - "Keymap for project commands that display buffers in other windows.") - -(defvar project-other-frame-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-o" #'project-display-buffer-other-frame) - map) - "Keymap for project commands that display buffers in other frames.") - -(defun project--other-place-command (action &optional map) +(defun project--other-place-command (action) (let* ((key (read-key-sequence-vector nil t)) - (place-cmd (lookup-key map key)) - (generic-cmd (lookup-key project-prefix-map key)) - (display-buffer-overriding-action (unless place-cmd action))) - (if-let ((cmd (or place-cmd generic-cmd))) + (cmd (lookup-key project-prefix-map key)) + (display-buffer-overriding-action action) + (switch-to-buffer-obey-display-actions t)) + (if cmd (call-interactively cmd) (user-error "%s is undefined" (key-description key))))) @@ -628,8 +611,7 @@ project-other-window-command \\{project-other-window-map}" (interactive) (project--other-place-command '((display-buffer-pop-up-window) - (inhibit-same-window . t)) - project-other-window-map)) + (inhibit-same-window . t)))) ;;;###autoload (define-key ctl-x-4-map "p" #'project-other-window-command) @@ -642,8 +624,7 @@ project-other-frame-command \\{project-prefix-map} \\{project-other-frame-map}" (interactive) - (project--other-place-command '((display-buffer-pop-up-frame)) - project-other-frame-map)) + (project--other-place-command '((display-buffer-pop-up-frame)))) ;;;###autoload (define-key ctl-x-5-map "p" #'project-other-frame-command) @@ -971,31 +952,7 @@ project-switch-to-buffer project instances, as reported by `project-current' in each buffer, are identical." (interactive (list (project--read-project-buffer))) - (switch-to-buffer buffer)) - -;;;###autoload -(defun project-display-buffer (buffer-or-name) - "Display BUFFER-OR-NAME in some window, without selecting it. -When called interactively, prompts for a buffer belonging to the -current project. Two buffers belong to the same project if their -project instances, as reported by `project-current' in each -buffer, are identical." - (interactive (list (project--read-project-buffer))) - (display-buffer buffer)) - -;;;###autoload -(defun project-display-buffer-other-frame (buffer-or-name) - "Display BUFFER-OR-NAME preferably in another frame. -When called interactively, prompts for a buffer belonging to the -current project. Two buffers belong to the same project if their -project instances, as reported by `project-current' in each -buffer, are identical. - -This function uses `display-buffer-other-frame' as a subroutine, -which see for how it is determined where the buffer will be -displayed." - (interactive (list (project--read-project-buffer))) - (display-buffer-other-frame buffer)) + (switch-to-buffer buffer-or-name)) (defcustom project-kill-buffers-ignores '("\\*Help\\*") --------------DF21B87F1071D9272AAA3A5E--