~yoctocell/git-email-devel

2 2

Re: [PATCH 4/6] Fix project.el project string for Emacs 29

Details
Message ID
<875yn8h9i4.fsf@posteo.net>
DKIM signature
pass
Download raw message
Shouldn't this be using project-root?  The current project could be
anything you can apply cl-defmethod to, not just a vc-backend.

-- 
	Philip Kaludercic

Re: [PATCH 4/6] Fix project.el project string for Emacs 29

Details
Message ID
<87fsmcz8gw.fsf@protesilaos.com>
In-Reply-To
<875yn8h9i4.fsf@posteo.net> (view parent)
DKIM signature
pass
Download raw message
Patch: +7 -1
On 2022-04-16, 23:52 +0000, Philip Kaludercic <philipk@posteo.net> wrote:

> Shouldn't this be using project-root?  The current project could be
> anything you can apply cl-defmethod to, not just a vc-backend.

You mean like (project-root (project-current))?

Note that the compiler now complains that we should depend on Emacs 28.1
for 'project-root'.

---
From 0f3b727d8a22ca51a1c6b0ebba9811c563aa2366 Mon Sep 17 00:00:00 2001
Message-Id: <0f3b727d8a22ca51a1c6b0ebba9811c563aa2366.1650166162.git.info@protesilaos.com>
From: Protesilaos Stavrou <info@protesilaos.com>
Date: Thu, 14 Apr 2022 08:13:31 +0300
Subject: [PATCH v2] Fix project.el project string for Emacs 29

---
 git-email.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/git-email.el b/git-email.el
index a1dff79..11ee6af 100644
--- a/git-email.el
+++ b/git-email.el
@@ -245,13 +245,19 @@ (defun git-email--get-files ()

(declare-function projectile-project-root "projectile")

(defun git-email--project-current ()
  "Return directory from `project-current' based on Emacs version."
  (if (>= emacs-major-version 29)
      (project-root (project-current))
    (cdr (project-current))))

(defun git-email--get-current-project ()
  "Return the path of the current project.
Falls back to `default-directory'."
  (or (and (bound-and-true-p projectile-known-projects)
           (projectile-project-root))
      (and (bound-and-true-p project-list-file)
           (cdr (project-current)))
           (git-email--project-current))
      (vc-root-dir)
      default-directory))

-- 
2.35.3



-- 
Protesilaos Stavrou
https://protesilaos.com

Re: [PATCH 4/6] Fix project.el project string for Emacs 29

Details
Message ID
<87tuasf7tk.fsf@posteo.net>
In-Reply-To
<87fsmcz8gw.fsf@protesilaos.com> (view parent)
DKIM signature
pass
Download raw message
Protesilaos Stavrou <info@protesilaos.com> writes:

> On 2022-04-16, 23:52 +0000, Philip Kaludercic <philipk@posteo.net> wrote:
>
>> Shouldn't this be using project-root?  The current project could be
>> anything you can apply cl-defmethod to, not just a vc-backend.
>
> You mean like (project-root (project-current))?

Yes,

> Note that the compiler now complains that we should depend on Emacs 28.1
> for 'project-root'.

Yes, because the function was (re-)added in 2020, which was eventually
part of Emacs 28.1,

https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5044c19001fe608f2eac621add2e05cbca6c804b

but by adding the dependency on ELPA's project, it should be possible to
use the function prior to 28.1.

> ---
> From 0f3b727d8a22ca51a1c6b0ebba9811c563aa2366 Mon Sep 17 00:00:00 2001
> Message-Id: <0f3b727d8a22ca51a1c6b0ebba9811c563aa2366.1650166162.git.info@protesilaos.com>
> From: Protesilaos Stavrou <info@protesilaos.com>
> Date: Thu, 14 Apr 2022 08:13:31 +0300
> Subject: [PATCH v2] Fix project.el project string for Emacs 29
>
> ---
>  git-email.el | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/git-email.el b/git-email.el
> index a1dff79..11ee6af 100644
> --- a/git-email.el
> +++ b/git-email.el
> @@ -245,13 +245,19 @@ (defun git-email--get-files ()
>  
>  (declare-function projectile-project-root "projectile")
>  
> +(defun git-email--project-current ()
> +  "Return directory from `project-current' based on Emacs version."
> +  (if (>= emacs-major-version 29)
> +      (project-root (project-current))
> +    (cdr (project-current))))
> +
>  (defun git-email--get-current-project ()
>    "Return the path of the current project.
>  Falls back to `default-directory'."
>    (or (and (bound-and-true-p projectile-known-projects)
>             (projectile-project-root))
>        (and (bound-and-true-p project-list-file)
> -           (cdr (project-current)))
> +           (git-email--project-current))
>        (vc-root-dir)
>        default-directory))
>  
> -- 
>
> 2.35.3

-- 
	Philip Kaludercic
Reply to thread Export thread (mbox)