emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Teach org-version to include git version information
@ 2009-08-18 17:22 Bernt Hansen
  2009-08-18 17:22 ` [PATCH 1/2] Add git version number to org-version information Bernt Hansen
                   ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-18 17:22 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

This series teaches org-version to include the git version number
information from git describe when running org-mode from a git repository.

The version is reported as dirty if tracked files are modified.

This series is available at git://git.norang.ca/org-mode for-carsten

Bernt Hansen (2):
  Add git version number to org-version information
  Add .dirty to git org-version info if files are modified

 lisp/org.el |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 1/2] Add git version number to org-version information
  2009-08-18 17:22 [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
@ 2009-08-18 17:22 ` Bernt Hansen
  2009-08-18 17:22 ` [PATCH 2/2] Add .dirty to git org-version info if files are modified Bernt Hansen
  2009-08-18 19:08 ` [PATCH 0/2] Teach org-version to include git version information Carsten Dominik
  2 siblings, 0 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-18 17:22 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

Adds the output of 'git describe' to the org-version string if we are running
from a git repository.  This identifies exactly what commit is checked out in
the org-mode git repository when reporting the org-mode version number.

org-version returns something like:

    Org-mode version 6.29trans (release_6.29c.42.g5996)

which shows 6.29trans (somewhere after the last release tag) which
is 42 commits after release_6.29c at git commit 5996.

The git describe information is not included if org mode is not
running from a git repository.
---
 lisp/org.el |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index b9f4229..3560a50 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -102,10 +102,22 @@
   "Show the org-mode version in the echo area.
 With prefix arg HERE, insert it at point."
   (interactive "P")
-  (let ((version (format "Org-mode version %s" org-version)))
-    (message version)
-    (if here
-	(insert version))))
+  (let* ((org-version org-version)
+	 (dir (concat (file-name-directory (locate-library "org")) "../" )))
+    (if (file-exists-p (expand-file-name ".git" dir))
+	(progn
+	 (shell-command (concat "cd " dir " && git describe --abbrev=4 HEAD"))
+	 (save-excursion
+	   (set-buffer "*Shell Command Output*")
+	   (goto-char (point-min))
+	   (replace-regexp "-" ".")
+	   (goto-char (point-min))
+	   (re-search-forward "[^\n]+")
+	   (setq org-version (concat org-version " (" (match-string 0) ")")))))
+    (let ((version (format "Org-mode version %s" org-version)))
+      (message version)
+      (if here
+	  (insert version)))))
 
 ;;; Compatibility constants
 
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 2/2] Add .dirty to git org-version info if files are modified
  2009-08-18 17:22 [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
  2009-08-18 17:22 ` [PATCH 1/2] Add git version number to org-version information Bernt Hansen
@ 2009-08-18 17:22 ` Bernt Hansen
  2009-08-18 19:08 ` [PATCH 0/2] Teach org-version to include git version information Carsten Dominik
  2 siblings, 0 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-18 17:22 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

Shows files as modified by appending .dirty to indicate that
you are running org-mode from a dirty working tree (some tracked
files are modified)
---
 lisp/org.el |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3560a50..26b2808 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -103,6 +103,7 @@
 With prefix arg HERE, insert it at point."
   (interactive "P")
   (let* ((org-version org-version)
+	 (git-version)
 	 (dir (concat (file-name-directory (locate-library "org")) "../" )))
     (if (file-exists-p (expand-file-name ".git" dir))
 	(progn
@@ -113,7 +114,11 @@ With prefix arg HERE, insert it at point."
 	   (replace-regexp "-" ".")
 	   (goto-char (point-min))
 	   (re-search-forward "[^\n]+")
-	   (setq org-version (concat org-version " (" (match-string 0) ")")))))
+	   (setq git-version (match-string 0))
+	   (shell-command (concat "cd " dir " && git diff-index --name-only HEAD --"))
+	   (unless (eql 1 (point-max))
+	     (setq git-version (concat git-version ".dirty")))
+	   (setq org-version (concat org-version " (" git-version ")")))))
     (let ((version (format "Org-mode version %s" org-version)))
       (message version)
       (if here
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 17:22 [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
  2009-08-18 17:22 ` [PATCH 1/2] Add git version number to org-version information Bernt Hansen
  2009-08-18 17:22 ` [PATCH 2/2] Add .dirty to git org-version info if files are modified Bernt Hansen
@ 2009-08-18 19:08 ` Carsten Dominik
  2009-08-18 19:10   ` Bernt Hansen
  2 siblings, 1 reply; 43+ messages in thread
From: Carsten Dominik @ 2009-08-18 19:08 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Awesome!

I had meant to ask you for this change.

THanks!

- Carsten

On Aug 18, 2009, at 6:22 PM, Bernt Hansen wrote:

> This series teaches org-version to include the git version number
> information from git describe when running org-mode from a git  
> repository.
>
> The version is reported as dirty if tracked files are modified.
>
> This series is available at git://git.norang.ca/org-mode for-carsten
>
> Bernt Hansen (2):
>  Add git version number to org-version information
>  Add .dirty to git org-version info if files are modified
>
> lisp/org.el |   25 +++++++++++++++++++++----
> 1 files changed, 21 insertions(+), 4 deletions(-)
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 19:08 ` [PATCH 0/2] Teach org-version to include git version information Carsten Dominik
@ 2009-08-18 19:10   ` Bernt Hansen
  2009-08-18 19:15     ` Carsten Dominik
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-18 19:10 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

I don't know if that will work on Windows (with git).  I've only tested
it on Linux here.  You may want to test drive it before including it.

-Bernt


Carsten Dominik <carsten.dominik@gmail.com> writes:

> Awesome!
>
> I had meant to ask you for this change.
>
> THanks!
>
> - Carsten
>
> On Aug 18, 2009, at 6:22 PM, Bernt Hansen wrote:
>
>> This series teaches org-version to include the git version number
>> information from git describe when running org-mode from a git
>> repository.
>>
>> The version is reported as dirty if tracked files are modified.
>>
>> This series is available at git://git.norang.ca/org-mode for-carsten
>>
>> Bernt Hansen (2):
>>  Add git version number to org-version information
>>  Add .dirty to git org-version info if files are modified
>>
>> lisp/org.el |   25 +++++++++++++++++++++----
>> 1 files changed, 21 insertions(+), 4 deletions(-)
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 19:10   ` Bernt Hansen
@ 2009-08-18 19:15     ` Carsten Dominik
  2009-08-18 19:30       ` Stefan Vollmar
  2009-08-19 10:10       ` Manish
  0 siblings, 2 replies; 43+ messages in thread
From: Carsten Dominik @ 2009-08-18 19:15 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:

> I don't know if that will work on Windows (with git).  I've only  
> tested
> it on Linux here.  You may want to test drive it before including it.

I have already included it, please test

M-x org-version

on your system and let me know if it causes problems anywhere.

- Carsten


>
> -Bernt
>
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Awesome!
>>
>> I had meant to ask you for this change.
>>
>> THanks!
>>
>> - Carsten
>>
>> On Aug 18, 2009, at 6:22 PM, Bernt Hansen wrote:
>>
>>> This series teaches org-version to include the git version number
>>> information from git describe when running org-mode from a git
>>> repository.
>>>
>>> The version is reported as dirty if tracked files are modified.
>>>
>>> This series is available at git://git.norang.ca/org-mode for-carsten
>>>
>>> Bernt Hansen (2):
>>> Add git version number to org-version information
>>> Add .dirty to git org-version info if files are modified
>>>
>>> lisp/org.el |   25 +++++++++++++++++++++----
>>> 1 files changed, 21 insertions(+), 4 deletions(-)
>>>
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Remember: use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 19:15     ` Carsten Dominik
@ 2009-08-18 19:30       ` Stefan Vollmar
  2009-08-18 19:44         ` Bernt Hansen
  2009-08-19 10:10       ` Manish
  1 sibling, 1 reply; 43+ messages in thread
From: Stefan Vollmar @ 2009-08-18 19:30 UTC (permalink / raw)
  To: emacs-orgmode

Dear Carsten,
dear Bernt,

On 18.08.2009, at 21:15, Carsten Dominik wrote:

> On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
>
>> I don't know if that will work on Windows (with git).  I've only  
>> tested
>> it on Linux here.  You may want to test drive it before including it.
>
> I have already included it, please test
>
> M-x org-version
>
> on your system and let me know if it causes problems anywhere.

I just did a "make update" on MacOS X 10.5.8 and M-x org-version in  
Aquamacs 2.0pr2 now yields: "release_6.29c.44.ga32e.dirty" (my  
Makefile contains a path modification), according to Bernt's comment  
of commit a5e87a47230030ab4c4bc4521f5af47a7521243a, "44" refers to 44  
commits after "release_6.29c" (neat!). What is the meaning of "ga32e"?

Warm regards,
  Stefan
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 19:30       ` Stefan Vollmar
@ 2009-08-18 19:44         ` Bernt Hansen
  2009-08-18 19:48           ` Stefan Vollmar
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-18 19:44 UTC (permalink / raw)
  To: Stefan Vollmar; +Cc: emacs-orgmode

Stefan Vollmar <vollmar@nf.mpg.de> writes:

> Dear Carsten,
> dear Bernt,
>
> On 18.08.2009, at 21:15, Carsten Dominik wrote:
>
>> On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
>>
>>> I don't know if that will work on Windows (with git).  I've only
>>> tested
>>> it on Linux here.  You may want to test drive it before including it.
>>
>> I have already included it, please test
>>
>> M-x org-version
>>
>> on your system and let me know if it causes problems anywhere.
>
> I just did a "make update" on MacOS X 10.5.8 and M-x org-version in
> Aquamacs 2.0pr2 now yields: "release_6.29c.44.ga32e.dirty" (my
> Makefile contains a path modification), according to Bernt's comment
> of commit a5e87a47230030ab4c4bc4521f5af47a7521243a, "44" refers to 44
> commits after "release_6.29c" (neat!). What is the meaning of "ga32e"?

ga32e - the g stands for 'git' and a32e is the first 4 digits of the
SHA1 for that commit.

git show a32e

will show that commit.

The last part of that comment talks about the ga32e part.

,----
|         Org-mode version 6.29trans (release_6.29c.42.g5996)
|     
|     which shows 6.29trans (somewhere after the last release tag) which
|     is 42 commits after release_6.29c at git commit 5996.
`----

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 19:44         ` Bernt Hansen
@ 2009-08-18 19:48           ` Stefan Vollmar
  0 siblings, 0 replies; 43+ messages in thread
From: Stefan Vollmar @ 2009-08-18 19:48 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Dear Bernt,

On 18.08.2009, at 21:44, Bernt Hansen wrote:

>> I just did a "make update" on MacOS X 10.5.8 and M-x org-version in
>> Aquamacs 2.0pr2 now yields: "release_6.29c.44.ga32e.dirty" (my
>> Makefile contains a path modification), according to Bernt's comment
>> of commit a5e87a47230030ab4c4bc4521f5af47a7521243a, "44" refers to 44
>> commits after "release_6.29c" (neat!). What is the meaning of  
>> "ga32e"?
>
> ga32e - the g stands for 'git' and a32e is the first 4 digits of the
> SHA1 for that commit.


excellent, thanks!
Warm regards,
  Stefan
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-18 19:15     ` Carsten Dominik
  2009-08-18 19:30       ` Stefan Vollmar
@ 2009-08-19 10:10       ` Manish
  2009-08-19 11:24         ` Bernt Hansen
  2009-08-19 12:21         ` Nick Dokos
  1 sibling, 2 replies; 43+ messages in thread
From: Manish @ 2009-08-19 10:10 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode

On Wed, Aug 19, 2009 at 12:45 AM, Carsten Dominik wrote:
>
> On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
>
>> I don't know if that will work on Windows (with git). I've only tested
>> it on Linux here. You may want to test drive it before including it.
>
> I have already included it, please test
>
> M-x org-version
>
> on your system and let me know if it causes problems anywhere.

It doesn't work on Windows (at least in my setup.)  My git is from Cygwin and
Windows native Emacs from GNU.

- GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON
- Windows XP
- Cygwin git version 1.6.1.2

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 10:10       ` Manish
@ 2009-08-19 11:24         ` Bernt Hansen
  2009-08-19 12:01           ` Manish
  2009-08-19 12:21         ` Nick Dokos
  1 sibling, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 11:24 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode, Carsten Dominik

Manish <mailtomanish.sharma@gmail.com> writes:

> On Wed, Aug 19, 2009 at 12:45 AM, Carsten Dominik wrote:
>>
>> On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
>>
>>> I don't know if that will work on Windows (with git). I've only tested
>>> it on Linux here. You may want to test drive it before including it.
>>
>> I have already included it, please test
>>
>> M-x org-version
>>
>> on your system and let me know if it causes problems anywhere.
>
> It doesn't work on Windows (at least in my setup.)  My git is from Cygwin and
> Windows native Emacs from GNU.
>
> - GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON
> - Windows XP
> - Cygwin git version 1.6.1.2

Does it crash and cause an error or report the old org version as before?

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 11:24         ` Bernt Hansen
@ 2009-08-19 12:01           ` Manish
  2009-08-19 12:08             ` Bernt Hansen
  0 siblings, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 12:01 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

On Wed, Aug 19, 2009 at 4:54 PM, Bernt Hansen wrote:
> Manish writes:
>
>> On Wed, Aug 19, 2009 at 12:45 AM, Carsten Dominik wrote:
>>>
>>> On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
>>>
>>>> I don't know if that will work on Windows (with git). I've only tested
>>>> it on Linux here. You may want to test drive it before including it.
>>>
>>> I have already included it, please test
>>>
>>> M-x org-version
>>>
>>> on your system and let me know if it causes problems anywhere.
>>
>> It doesn't work on Windows (at least in my setup.)  My git is from Cygwin and
>> Windows native Emacs from GNU.
>>
>> - GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON
>> - Windows XP
>> - Cygwin git version 1.6.1.2
>
> Does it crash and cause an error or report the old org version as before?

It just reports the version as before; no crashing or error of any sort.

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 12:01           ` Manish
@ 2009-08-19 12:08             ` Bernt Hansen
  2009-08-19 12:19               ` Manish
  2009-08-19 13:22               ` Manish
  0 siblings, 2 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 12:08 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode, Carsten Dominik

Manish <mailtomanish.sharma@gmail.com> writes:

> On Wed, Aug 19, 2009 at 4:54 PM, Bernt Hansen wrote:
>> Does it crash and cause an error or report the old org version as before?
>
> It just reports the version as before; no crashing or error of any sort.

Okay that's good.  I don't have Emacs on windows here.  If you have time
to step through the org-version function in debug and figure out where
it fails we might be able to get it working on windows too.

My guess is that determining the location of the .git directory fails so
it acts just like it's not running from a git repository.

What do you get when evaluating the following form?

(file-name-directory (locate-library "org"))

I need to move up one directory from what that returns to see if the
.git directory exists and I append '../' to the path to move up on *nix
systems.  That probably doesn't work for windows.  Maybe there's a
better way to strip off the last directory from the path that
file-name-directory returns.

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 12:08             ` Bernt Hansen
@ 2009-08-19 12:19               ` Manish
  2009-08-19 12:30                 ` Bernt Hansen
  2009-08-19 13:22               ` Manish
  1 sibling, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 12:19 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

On Wed, Aug 19, 2009 at 5:38 PM, Bernt Hansen<bernt@norang.ca> wrote:
> Manish <mailtomanish.sharma@gmail.com> writes:
>
>> On Wed, Aug 19, 2009 at 4:54 PM, Bernt Hansen wrote:
>>> Does it crash and cause an error or report the old org version as before?
>>
>> It just reports the version as before; no crashing or error of any sort.
>
> Okay that's good. I don't have Emacs on windows here. If you have time
> to step through the org-version function in debug and figure out where
> it fails we might be able to get it working on windows too.

I'll find out how to do this and let you know the results.

>
> My guess is that determining the location of the .git directory fails so
> it acts just like it's not running from a git repository.
>
> What do you get when evaluating the following form?
>
> (file-name-directory (locate-library "org"))
>
> I need to move up one directory from what that returns to see if the
> .git directory exists and I append '../' to the path to move up on *nix
> systems. That probably doesn't work for windows. Maybe there's a
> better way to strip off the last directory from the path that
> file-name-directory returns.

It returns "d:/home/zms/elisp/org-mode.git/lisp/" cd'ing into
"d:/home/zms/elisp/org-mode.git/lisp/.." works in Cygwin but fails in
Windows shell due to front slahes.

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 10:10       ` Manish
  2009-08-19 11:24         ` Bernt Hansen
@ 2009-08-19 12:21         ` Nick Dokos
  2009-08-19 12:30           ` Manish
  1 sibling, 1 reply; 43+ messages in thread
From: Nick Dokos @ 2009-08-19 12:21 UTC (permalink / raw)
  To: Manish; +Cc: Bernt Hansen, emacs-orgmode, Carsten Dominik

Manish <mailtomanish.sharma@gmail.com> wrote:

> On Wed, Aug 19, 2009 at 12:45 AM, Carsten Dominik wrote:
> >
> > On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
> >
> >> I don't know if that will work on Windows (with git). I've only tested
> >> it on Linux here. You may want to test drive it before including it.
> >
> > I have already included it, please test
> >
> > M-x org-version
> >
> > on your system and let me know if it causes problems anywhere.
> 
> It doesn't work on Windows (at least in my setup.)  My git is from Cygwin and
> Windows native Emacs from GNU.
> 
> - GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON
> - Windows XP
> - Cygwin git version 1.6.1.2
> 

Does it break? Or does it just not provide the git information?

Thanks,
Nick

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 12:19               ` Manish
@ 2009-08-19 12:30                 ` Bernt Hansen
  2009-08-19 13:20                   ` Manish
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 12:30 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode

Manish,

Could you try this patch - does it work?

-Bernt

------------------------------------------------------------------------

From 1b26a9ef0a9105d3e855c242fce3a44d1b8cd9c7 Mon Sep 17 00:00:00 2001
From: Bernt Hansen <bernt@norang.ca>
Date: Wed, 19 Aug 2009 08:26:43 -0400
Subject: [PATCH] Fix org-version so the git version report works on windows too

---
 lisp/org.el |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index bd32b70..de971e2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -104,10 +104,10 @@ With prefix arg HERE, insert it at point."
   (interactive "P")
   (let* ((org-version org-version)
 	 (git-version)
-	 (dir (concat (file-name-directory (locate-library "org")) "../" )))
+	 (dir (file-truename (concat (file-name-directory (locate-library "org")) "../" ))))
     (if (file-exists-p (expand-file-name ".git" dir))
 	(progn
-	 (shell-command (concat "cd " dir " && git describe --abbrev=4 HEAD"))
+	 (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
 	 (save-excursion
 	   (set-buffer "*Shell Command Output*")
 	   (goto-char (point-min))
@@ -115,7 +115,7 @@ With prefix arg HERE, insert it at point."
 	   (goto-char (point-min))
 	   (re-search-forward "[^\n]+")
 	   (setq git-version (match-string 0))
-	   (shell-command (concat "cd " dir " && git diff-index --name-only HEAD --"))
+	   (shell-command (concat "GITDIR=" dir " && git diff-index --name-only HEAD --"))
 	   (unless (eql 1 (point-max))
 	     (setq git-version (concat git-version ".dirty")))
 	   (setq org-version (concat org-version " (" git-version ")")))))
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 12:21         ` Nick Dokos
@ 2009-08-19 12:30           ` Manish
  0 siblings, 0 replies; 43+ messages in thread
From: Manish @ 2009-08-19 12:30 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Bernt Hansen, emacs-orgmode, Carsten Dominik

On Wed, Aug 19, 2009 at 5:51 PM, Nick Dokos wrote:
> Manish wrote:
>
>> On Wed, Aug 19, 2009 at 12:45 AM, Carsten Dominik wrote:
>> >
>> > On Aug 18, 2009, at 8:10 PM, Bernt Hansen wrote:
>> >
>> >> I don't know if that will work on Windows (with git). I've only tested
>> >> it on Linux here. You may want to test drive it before including it.
>> >
>> > I have already included it, please test
>> >
>> > M-x org-version
>> >
>> > on your system and let me know if it causes problems anywhere.
>>
>> It doesn't work on Windows (at least in my setup.)  My git is from Cygwin and
>> Windows native Emacs from GNU.
>>
>> - GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON
>> - Windows XP
>> - Cygwin git version 1.6.1.2
>>
>
> Does it break? Or does it just not provide the git information?

It continues to work the way it used to work with no error or breakage.
Although I have reloaded and restarted org a few times, I will report again
after rebooting Emacs.

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 12:30                 ` Bernt Hansen
@ 2009-08-19 13:20                   ` Manish
  2009-08-19 13:32                     ` Bernt Hansen
  0 siblings, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 13:20 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

On Wed, Aug 19, 2009 at 6:00 PM, Bernt Hansen<bernt@norang.ca> wrote:
> Manish,
>
> Could you try this patch - does it work?

Patch application fails.  I tried with patch -p1 as well.

,----
| [Wed 19 18:47] (2118) ~/elisp/org-mode.git $ git apply
org-version-patch-by-bernt.patch
| error: patch failed: lisp/org.el:104
| error: lisp/org.el: patch does not apply
`----

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 12:08             ` Bernt Hansen
  2009-08-19 12:19               ` Manish
@ 2009-08-19 13:22               ` Manish
  2009-08-19 13:40                 ` Bernt Hansen
  1 sibling, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 13:22 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

On Wed, Aug 19, 2009 at 5:38 PM, Bernt Hansen wrote:
> Manish  writes:
>
>> On Wed, Aug 19, 2009 at 4:54 PM, Bernt Hansen wrote:
>>> Does it crash and cause an error or report the old org version as before?
>>
>> It just reports the version as before; no crashing or error of any sort.
>
> Okay that's good. I don't have Emacs on windows here. If you have time
> to step through the org-version function in debug and figure out where
> it fails we might be able to get it working on windows too.

I had not compiled the latest git and hence an older copy was
getting loaded because of which it kept working without any errors.
Now it returns: "Org-mode version 6.29trans (The system cannot find
the path specified..dirty)" Sorry about that.

When I tried to run the function under debug the *Shell Command
Output* buffer displays this message "The system cannot find the path
specified."  Perhaps this is because of the slashes since Windows
shell does not understand them?  Could we detect if we are on Windows
and use "\" instead of "/"?

Thanks
-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 13:20                   ` Manish
@ 2009-08-19 13:32                     ` Bernt Hansen
  2009-08-19 13:34                       ` Bernt Hansen
                                         ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 13:32 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode

Manish <mailtomanish.sharma@gmail.com> writes:

> On Wed, Aug 19, 2009 at 6:00 PM, Bernt Hansen<bernt@norang.ca> wrote:
>> Manish,
>>
>> Could you try this patch - does it work?
>
> Patch application fails.  I tried with patch -p1 as well.
>
> ,----
> | [Wed 19 18:47] (2118) ~/elisp/org-mode.git $ git apply
> org-version-patch-by-bernt.patch
> | error: patch failed: lisp/org.el:104
> | error: lisp/org.el: patch does not apply
> `----
>
> -- 
> Manish

Can you try evaluating this? and then M-x org-version and report the
results?

(defun org-version (&optional here)
  "Show the org-mode version in the echo area.
With prefix arg HERE, insert it at point."
  (interactive "P")
  (let* ((org-version org-version)
	 (git-version)
	 (dir (file-truename (concat (file-name-directory (locate-library "org")) "../" ))))
    (if (file-exists-p (expand-file-name ".git" dir))
	(progn
	 (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
	 (save-excursion
	   (set-buffer "*Shell Command Output*")
	   (goto-char (point-min))
	   (replace-regexp "-" ".")
	   (goto-char (point-min))
	   (re-search-forward "[^\n]+")
	   (setq git-version (match-string 0))
	   (shell-command (concat "GITDIR=" dir " && git diff-index --name-only HEAD --"))
	   (unless (eql 1 (point-max))
	     (setq git-version (concat git-version ".dirty")))
	   (setq org-version (concat org-version " (" git-version ")")))))
    (let ((version (format "Org-mode version %s" org-version)))
      (if here (insert version))
      (message version)
      version)))

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 13:32                     ` Bernt Hansen
@ 2009-08-19 13:34                       ` Bernt Hansen
  2009-08-19 13:58                       ` Manish
  2009-08-19 14:02                       ` Nick Dokos
  2 siblings, 0 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 13:34 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Can you try evaluating this? and then M-x org-version and report the
> results?

Nevermind - that version is broken.

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 13:22               ` Manish
@ 2009-08-19 13:40                 ` Bernt Hansen
  2009-08-19 13:57                   ` Nick Dokos
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 13:40 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode, Carsten Dominik

Manish <mailtomanish.sharma@gmail.com> writes:

> On Wed, Aug 19, 2009 at 5:38 PM, Bernt Hansen wrote:
>> Manish  writes:
>>
> When I tried to run the function under debug the *Shell Command
> Output* buffer displays this message "The system cannot find the path
> specified."  Perhaps this is because of the slashes since Windows
> shell does not understand them?  Could we detect if we are on Windows
> and use "\" instead of "/"?

I'm not sure how to determine if we're on windows vs something else.
Any suggestions?

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 13:40                 ` Bernt Hansen
@ 2009-08-19 13:57                   ` Nick Dokos
  0 siblings, 0 replies; 43+ messages in thread
From: Nick Dokos @ 2009-08-19 13:57 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik

Bernt Hansen <bernt@norang.ca> wrote:

> Manish <mailtomanish.sharma@gmail.com> writes:
> 
> > On Wed, Aug 19, 2009 at 5:38 PM, Bernt Hansen wrote:
> >> Manish  writes:
> >>
> > When I tried to run the function under debug the *Shell Command
> > Output* buffer displays this message "The system cannot find the path
> > specified."  Perhaps this is because of the slashes since Windows
> > shell does not understand them?  Could we detect if we are on Windows
> > and use "\" instead of "/"?
> 
> I'm not sure how to determine if we're on windows vs something else.
> Any suggestions?
> 

Check the variable system-type.

HTH,
Nick

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 13:32                     ` Bernt Hansen
  2009-08-19 13:34                       ` Bernt Hansen
@ 2009-08-19 13:58                       ` Manish
  2009-08-19 14:02                       ` Nick Dokos
  2 siblings, 0 replies; 43+ messages in thread
From: Manish @ 2009-08-19 13:58 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

On Wed, Aug 19, 2009 at 7:02 PM, Bernt Hansen wrote:
> Manish writes:
>
>> On Wed, Aug 19, 2009 at 6:00 PM, Bernt Hansen wrote:
>>> Manish,
>>>
>>> Could you try this patch - does it work?
>>
>> Patch application fails.  I tried with patch -p1 as well.
>>
>> ,----
>> | [Wed 19 18:47] (2118) ~/elisp/org-mode.git $ git apply
>> org-version-patch-by-bernt.patch
>> | error: patch failed: lisp/org.el:104
>> | error: lisp/org.el: patch does not apply
>> `----
>>
>> --
>> Manish
>
> Can you try evaluating this? and then M-x org-version and report the
> results?
>
> (defun org-version (&optional here)
>  "Show the org-mode version in the echo area.
> With prefix arg HERE, insert it at point."
>  (interactive "P")
>  (let* ((org-version org-version)
>         (git-version)
>         (dir (file-truename (concat (file-name-directory (locate-library "org")) "../" ))))
>    (if (file-exists-p (expand-file-name ".git" dir))
>        (progn
>         (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
>         (save-excursion
>           (set-buffer "*Shell Command Output*")
>           (goto-char (point-min))
>           (replace-regexp "-" ".")
>           (goto-char (point-min))
>           (re-search-forward "[^\n]+")
>           (setq git-version (match-string 0))
>           (shell-command (concat "GITDIR=" dir " && git diff-index --name-only HEAD --"))
>           (unless (eql 1 (point-max))
>             (setq git-version (concat git-version ".dirty")))
>           (setq org-version (concat org-version " (" git-version ")")))))
>    (let ((version (format "Org-mode version %s" org-version)))
>      (if here (insert version))
>      (message version)
>      version)))
>
> -Bernt
>

Results follows:

Org-mode version 6.29trans ('GITDIR' is not recognized as an internal
or external command,.dirty)

Sorry for the delay.. had to step away for sometime.

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 13:32                     ` Bernt Hansen
  2009-08-19 13:34                       ` Bernt Hansen
  2009-08-19 13:58                       ` Manish
@ 2009-08-19 14:02                       ` Nick Dokos
  2009-08-19 14:16                         ` Manish
  2009-08-19 14:17                         ` [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
  2 siblings, 2 replies; 43+ messages in thread
From: Nick Dokos @ 2009-08-19 14:02 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> wrote:

...
> 	 (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
...

Disclaimer: I touch Windows once a day to check a mail account and
possibly surf the web - other than that, I'm pretty much at sea in it
(and I've never used emacs on Windows, let alone install git on it.)
Please excuse the elementary questions.

How does shell-command work under Windows? What shell is it using?
Is cygwin a prerequisite for it? Is cygwin a prerequisite for git?

Thanks,
Nick

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:02                       ` Nick Dokos
@ 2009-08-19 14:16                         ` Manish
  2009-08-19 14:29                           ` Nick Dokos
  2009-08-19 14:17                         ` [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
  1 sibling, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 14:16 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Bernt Hansen, emacs-orgmode

On Wed, Aug 19, 2009 at 7:32 PM, Nick Dokos<nicholas.dokos@hp.com> wrote:
> Bernt Hansen <bernt@norang.ca> wrote:
>
> ...
>>    (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
> ...
>
> Disclaimer: I touch Windows once a day to check a mail account and
> possibly surf the web - other than that, I'm pretty much at sea in it
> (and I've never used emacs on Windows, let alone install git on it.)
> Please excuse the elementary questions.
>
> How does shell-command work under Windows?

No idea.

> What shell is it using?

Windows has it's own CMD shell (CMD.exe).

> Is cygwin a prerequisite for it?

Prerequisite for CMD? No.  CMD is native and comes with Windows.

> Is cygwin a prerequisite for git?

Native git on Windows was reported to have issues quite sometime back.  I read
somewhere that the situation is much better now.  Cygwin git has always worked
for me without any issues.

-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:02                       ` Nick Dokos
  2009-08-19 14:16                         ` Manish
@ 2009-08-19 14:17                         ` Bernt Hansen
  2009-08-19 14:41                           ` Manish
  1 sibling, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 14:17 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, Carsten Dominik

Nick Dokos <nicholas.dokos@hp.com> writes:

> Bernt Hansen <bernt@norang.ca> wrote:
>
> ...
>> 	 (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
> ...
>
> Disclaimer: I touch Windows once a day to check a mail account and
> possibly surf the web - other than that, I'm pretty much at sea in it
> (and I've never used emacs on Windows, let alone install git on it.)
> Please excuse the elementary questions.
>
> How does shell-command work under Windows? What shell is it using?
> Is cygwin a prerequisite for it? Is cygwin a prerequisite for git?
>
> Thanks,
> Nick

Nick,

You use windows more than me :)  I have no idea what shell it uses - but
if it's the DOS shell the && above is never going to work.

I have GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) of 2009-02-26 on
LENNART-69DE564 (patched) here which I can try.

I think this version uses the DOS shell and git which is installed on
the system isn't available from this shell.

Maybe I should just disable the git version for now on ms-dos,
windows-nt, and cygwin since I don't know how to make it work reliably
on windows.

Opinions?

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:16                         ` Manish
@ 2009-08-19 14:29                           ` Nick Dokos
  2009-08-19 14:42                             ` Bernt Hansen
  0 siblings, 1 reply; 43+ messages in thread
From: Nick Dokos @ 2009-08-19 14:29 UTC (permalink / raw)
  To: Manish; +Cc: Bernt Hansen, emacs-orgmode

Manish <mailtomanish.sharma@gmail.com> wrote:

> On Wed, Aug 19, 2009 at 7:32 PM, Nick Dokos<nicholas.dokos@hp.com> wrote:
> > Bernt Hansen <bernt@norang.ca> wrote:
> >
> > ...
> >>    (shell-command (concat "GITDIR=" dir " && git describe --abbrev=4 HEAD"))
> > ...
> >
> > Disclaimer: I touch Windows once a day to check a mail account and
> > possibly surf the web - other than that, I'm pretty much at sea in it
> > (and I've never used emacs on Windows, let alone install git on it.)
> > Please excuse the elementary questions.
> >
> > How does shell-command work under Windows?
> 
> No idea.
> 
> > What shell is it using?
> 
> Windows has it's own CMD shell (CMD.exe).
> 
> > Is cygwin a prerequisite for it?
> 
> Prerequisite for CMD? No.  CMD is native and comes with Windows.
> 
> > Is cygwin a prerequisite for git?
> 
> Native git on Windows was reported to have issues quite sometime back.  I read
> somewhere that the situation is much better now.  Cygwin git has always worked
> for me without any issues.
> 

Manish,

Thanks! IIUC, there are then multiple forks in the decision tree:

        o running on Windows or on something else?

        o if on Windows, running native or under cygwin?

        o what shell am I using? cmd.exe and bash under cygwin accept
        different syntax - in particular, the GITDIR=foo solution of
        setting env variables has no hope of working under cmd.exe -
        is that correct?

Sounds complicated. Maybe the best solution for now is to punt on
the git information on Windows?

    (when (not (member system-type '(ms-dos windows-nt cygwin)))
          ...add git info...)

What about system-type == "darwin"? Does Bernt's code work there?

Thanks,
Nick

        

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:17                         ` [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
@ 2009-08-19 14:41                           ` Manish
  2009-08-19 14:44                             ` Bernt Hansen
  0 siblings, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 14:41 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Carsten Dominik, emacs-orgmode

On Wed, Aug 19, 2009 at 7:47 PM, Bernt Hansen wrote:
[snip: attempting to make git reporting functionality in org-version (29 lines)]
>
> Maybe I should just disable the git version for now on ms-dos,
> windows-nt, and cygwin since I don't know how to make it work reliably
> on windows.
>
> Opinions?

It appears there are very few Windows users on the list so I guess the
effort involved does not benefit a lot of people anyways.  I am okay
if you would like to disable the functionality on Windows.

-- Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:29                           ` Nick Dokos
@ 2009-08-19 14:42                             ` Bernt Hansen
  2009-08-19 14:51                               ` Manish
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 14:42 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> Thanks! IIUC, there are then multiple forks in the decision tree:
>
>         o running on Windows or on something else?
>
>         o if on Windows, running native or under cygwin?
>
>         o what shell am I using? cmd.exe and bash under cygwin accept
>         different syntax - in particular, the GITDIR=foo solution of
>         setting env variables has no hope of working under cmd.exe -
>         is that correct?
>
> Sounds complicated. Maybe the best solution for now is to punt on
> the git information on Windows?
>
>     (when (not (member system-type '(ms-dos windows-nt cygwin)))
>           ...add git info...)
>
> What about system-type == "darwin"? Does Bernt's code work there?

Yes it'll be complicated.  Right now I think we should punt and just go
back to the old org-version reporting for windows until we can get a
better working solution since the current version breaks on windows.
I'll try to provide a patch for this.

Manish:

What value do you have for system-type?  I expect it says 'windows-nt'

If that's true then the problem is determining if
  - git is installed
    - what version?  Msysgit?  cygwin git?
  - what shells are available (since CMD.exe has little hope of working)
    - msysgit bash
    - cygwin shell
    - cmd (won't work if msysgit was installed with git in the msysgit
           bash shell only)
  - running some other shell (git-bash, cygwin) so the git executable is
    available and provide the right syntax for each to Do The Right
    Thing(tm)

Right now I'm inclined to skip the git-version magic if system-type is
windows-nt just to stop it from breaking on that platform.

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:41                           ` Manish
@ 2009-08-19 14:44                             ` Bernt Hansen
  0 siblings, 0 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 14:44 UTC (permalink / raw)
  To: Manish; +Cc: Carsten Dominik, emacs-orgmode

Manish <mailtomanish.sharma@gmail.com> writes:

> On Wed, Aug 19, 2009 at 7:47 PM, Bernt Hansen wrote:
> [snip: attempting to make git reporting functionality in org-version (29 lines)]
>>
>> Maybe I should just disable the git version for now on ms-dos,
>> windows-nt, and cygwin since I don't know how to make it work reliably
>> on windows.
>>
>> Opinions?
>
> It appears there are very few Windows users on the list so I guess the
> effort involved does not benefit a lot of people anyways.  I am okay
> if you would like to disable the functionality on Windows.

If you want to work with me off-list we can pursue this and see if we
can cobble something together that works.

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:42                             ` Bernt Hansen
@ 2009-08-19 14:51                               ` Manish
  2009-08-19 15:04                                 ` Nick Dokos
  0 siblings, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 14:51 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

On Wed, Aug 19, 2009 at 8:12 PM, Bernt Hansen wrote:
> Nick Dokos writes:
>
>> Thanks! IIUC, there are then multiple forks in the decision tree:
>>
>>     o running on Windows or on something else?
>>
>>     o if on Windows, running native or under cygwin?
>>
>>     o what shell am I using? cmd.exe and bash under cygwin accept
>>     different syntax - in particular, the GITDIR=foo solution of
>>     setting env variables has no hope of working under cmd.exe -
>>     is that correct?
>>
>> Sounds complicated. Maybe the best solution for now is to punt on
>> the git information on Windows?
>>
>>   (when (not (member system-type '(ms-dos windows-nt cygwin)))
>>      ...add git info...)
>>
>> What about system-type == "darwin"? Does Bernt's code work there?
>
> Yes it'll be complicated. Right now I think we should punt and just go
> back to the old org-version reporting for windows until we can get a
> better working solution since the current version breaks on windows.
> I'll try to provide a patch for this.
>
> Manish:
>
> What value do you have for system-type? I expect it says 'windows-nt'

Yes, it does.

>
> If that's true then the problem is determining if
> - git is installed
>  - what version? Msysgit? cygwin git?
> - what shells are available (since CMD.exe has little hope of working)
>  - msysgit bash
>  - cygwin shell
>  - cmd (won't work if msysgit was installed with git in the msysgit
>      bash shell only)
> - running some other shell (git-bash, cygwin) so the git executable is
>  available and provide the right syntax for each to Do The Right
>  Thing(tm)

Do we test if git is installed if we are on a non-Windows system or
show whatever error shell returns in case git is not installed?

I tried calling cygwin git from CMD shell and it seems to work okay.
So I am guessing we need to figure out how to correctly pass git
command from Emacs to Windows shell.  I will try to find examples from
Org's PDF processing code.

>
> Right now I'm inclined to skip the git-version magic if system-type is
> windows-nt just to stop it from breaking on that platform.

Sure.  I will share some information/examples if I can find anything
to make it work.

Thanks
-- 
Manish>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 14:51                               ` Manish
@ 2009-08-19 15:04                                 ` Nick Dokos
  2009-08-19 15:10                                   ` Manish
  2009-08-19 15:16                                   ` Bernt Hansen
  0 siblings, 2 replies; 43+ messages in thread
From: Nick Dokos @ 2009-08-19 15:04 UTC (permalink / raw)
  To: Manish; +Cc: Bernt Hansen, emacs-orgmode

Manish <mailtomanish.sharma@gmail.com> wrote:


> ... 
> Do we test if git is installed if we are on a non-Windows system or
> show whatever error shell returns in case git is not installed?
> 
> I tried calling cygwin git from CMD shell and it seems to work okay.
> So I am guessing we need to figure out how to correctly pass git
> command from Emacs to Windows shell.  I will try to find examples from
> Org's PDF processing code.
> 

Bernt's code checks for the existence of the .git subdirectory
in the parent directory of wherever emacs get the org.el[c] library:
if it's present, then the assumption is that git is installed.

HTH,
Nick

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 15:04                                 ` Nick Dokos
@ 2009-08-19 15:10                                   ` Manish
  2009-08-19 15:16                                   ` Bernt Hansen
  1 sibling, 0 replies; 43+ messages in thread
From: Manish @ 2009-08-19 15:10 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Bernt Hansen, emacs-orgmode

On Wed, Aug 19, 2009 at 8:34 PM, Nick Dokos wrote:
> Manish <mailtomanish.sharma@gmail.com> wrote:
>
>
>> ...
>> Do we test if git is installed if we are on a non-Windows system or
>> show whatever error shell returns in case git is not installed?
>>
>> I tried calling cygwin git from CMD shell and it seems to work okay.
>> So I am guessing we need to figure out how to correctly pass git
>> command from Emacs to Windows shell. I will try to find examples from
>> Org's PDF processing code.
>>
>
> Bernt's code checks for the existence of the .git subdirectory
> in the parent directory of wherever emacs get the org.el[c] library:
> if it's present, then the assumption is that git is installed.

Yeah.. that makes sense.

Thanks
-- 
Manish

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 15:04                                 ` Nick Dokos
  2009-08-19 15:10                                   ` Manish
@ 2009-08-19 15:16                                   ` Bernt Hansen
  2009-08-19 15:23                                     ` Manish
  1 sibling, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 15:16 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> Manish <mailtomanish.sharma@gmail.com> wrote:
>
>
>> ... 
>> Do we test if git is installed if we are on a non-Windows system or
>> show whatever error shell returns in case git is not installed?
>> 
>> I tried calling cygwin git from CMD shell and it seems to work okay.
>> So I am guessing we need to figure out how to correctly pass git
>> command from Emacs to Windows shell.  I will try to find examples from
>> Org's PDF processing code.
>> 
>
> Bernt's code checks for the existence of the .git subdirectory
> in the parent directory of wherever emacs get the org.el[c] library:
> if it's present, then the assumption is that git is installed.

Well maybe.  I have an older version of Emacs 23 installed on my
windows Eee PC system and I have msysGit installed (not cygwin git) but
it's not available to the shell as a command.  Nothing prevents me from
running org-mode from a git repository there.

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 15:16                                   ` Bernt Hansen
@ 2009-08-19 15:23                                     ` Manish
  2009-08-19 15:27                                       ` Bernt Hansen
  0 siblings, 1 reply; 43+ messages in thread
From: Manish @ 2009-08-19 15:23 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

On Wed, Aug 19, 2009 at 8:46 PM, Bernt Hansen wrote:
> Nick Dokos writes:
>
[...]
>>
>> Bernt's code checks for the existence of the .git subdirectory
>> in the parent directory of wherever emacs get the org.el[c] library:
>> if it's present, then the assumption is that git is installed.
>
> Well maybe. I have an older version of Emacs 23 installed on my
> windows Eee PC system and I have msysGit installed (not cygwin git) but
> it's not available to the shell as a command.

It should be, I think.  May be it's not added to PATH environment variable?
You can set it up like so:

1. Right-click on "My Computer", click "Properties"
2. Click on "Advanced" tab
3. Click "Environment Variables" button
4. Add the path to git binary under System or User PATH variable.
5. Restart Emacs and test again.

-- 
Manish

> Nothing prevents me from
> running org-mode from a git repository there.
>
> -Bernt
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] Teach org-version to include git version information
  2009-08-19 15:23                                     ` Manish
@ 2009-08-19 15:27                                       ` Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 0/2] org-version fix for windows Bernt Hansen
                                                           ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 15:27 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode

Manish <mailtomanish.sharma@gmail.com> writes:

> On Wed, Aug 19, 2009 at 8:46 PM, Bernt Hansen wrote:
>> Nick Dokos writes:
>>
> [...]
>>>
>>> Bernt's code checks for the existence of the .git subdirectory
>>> in the parent directory of wherever emacs get the org.el[c] library:
>>> if it's present, then the assumption is that git is installed.
>>
>> Well maybe. I have an older version of Emacs 23 installed on my
>> windows Eee PC system and I have msysGit installed (not cygwin git) but
>> it's not available to the shell as a command.
>
> It should be, I think.  May be it's not added to PATH environment variable?
> You can set it up like so:
>
> 1. Right-click on "My Computer", click "Properties"
> 2. Click on "Advanced" tab
> 3. Click "Environment Variables" button
> 4. Add the path to git binary under System or User PATH variable.
> 5. Restart Emacs and test again.

The msysGit installation gives a choice to include the git executables
in the path or not.  I'm not sure what the current state of that is but
they used to recommend _not_ installing it for cmd.exe so we can't
assume that it's available.

I can probably find the msysgit shell if it's available and run that
instead.

-Bernt

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 0/2] org-version fix for windows
  2009-08-19 15:27                                       ` Bernt Hansen
@ 2009-08-19 20:06                                         ` Bernt Hansen
  2009-08-20  3:54                                           ` Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 1/2] Use lisp cd function to change directories to avoid shell dependencies Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 2/2] Skip git-version determination if git command fails Bernt Hansen
  2 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 20:06 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

Here are two patches which fix org-version for windows.

This should handle cygwin and msysGit where git is installed for use
by the default Windows command shell.  This does not currently support
msysGit where git is not installed in the user's PATH.

The series is available at git://git.norang.ca/org-mode for-carsten

Bernt Hansen (2):
  Use lisp cd function to change directories to avoid shell
    dependencies
  Skip git-version determination if git command fails

 lisp/org.el |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 1/2] Use lisp cd function to change directories to avoid shell dependencies
  2009-08-19 15:27                                       ` Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 0/2] org-version fix for windows Bernt Hansen
@ 2009-08-19 20:06                                         ` Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 2/2] Skip git-version determination if git command fails Bernt Hansen
  2 siblings, 0 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 20:06 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

This fixes git version determination on windows for cygwin and for msysGit
where git is installed in the user's PATH for the windows command shell.
---
 lisp/org.el |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e2cdce8..63ce2de 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -104,25 +104,27 @@ With prefix arg HERE, insert it at point."
   (interactive "P")
   (let* ((org-version org-version)
 	 (git-version)
-	 (dir (concat (file-name-directory (locate-library "org")) "../" )))
+	 (dir (concat (file-name-directory (locate-library "org")) "../" ))
+	 (version))
     (if (file-exists-p (expand-file-name ".git" dir))
-	(progn
-	 (shell-command (concat "cd " dir " && git describe --abbrev=4 HEAD"))
-	 (save-excursion
-	   (set-buffer "*Shell Command Output*")
-	   (goto-char (point-min))
-	   (replace-regexp "-" ".")
-	   (goto-char (point-min))
-	   (re-search-forward "[^\n]+")
-	   (setq git-version (match-string 0))
-	   (shell-command (concat "cd " dir " && git diff-index --name-only HEAD --"))
-	   (unless (eql 1 (point-max))
-	     (setq git-version (concat git-version ".dirty")))
-	   (setq org-version (concat org-version " (" git-version ")")))))
-    (let ((version (format "Org-mode version %s" org-version)))
-      (if here (insert version))
-      (message version)
-      version)))
+	(let ((pwd (substring (pwd) 10)))
+	  (cd dir)
+	  (shell-command "git describe --abbrev=4 HEAD")
+	  (save-excursion
+	    (set-buffer "*Shell Command Output*")
+	    (goto-char (point-min))
+	    (re-search-forward "[^\n]+")
+	    (setq git-version (match-string 0))
+	    (subst-char-in-string ?- ?. git-version t)
+	    (shell-command "git diff-index --name-only HEAD --")
+	    (unless (eql 1 (point-max))
+	      (setq git-version (concat git-version ".dirty")))
+	    (setq org-version (concat org-version " (" git-version ")")))
+	  (cd pwd)))
+    (setq version (format "Org-mode version %s" org-version))
+    (if here (insert version))
+    (message version)
+    version))
 
 ;;; Compatibility constants
 
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 2/2] Skip git-version determination if git command fails
  2009-08-19 15:27                                       ` Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 0/2] org-version fix for windows Bernt Hansen
  2009-08-19 20:06                                         ` [PATCH 1/2] Use lisp cd function to change directories to avoid shell dependencies Bernt Hansen
@ 2009-08-19 20:06                                         ` Bernt Hansen
  2 siblings, 0 replies; 43+ messages in thread
From: Bernt Hansen @ 2009-08-19 20:06 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

This removes errors generated on a windows system where msysGit is
installed in git bash only and not available from cmd.exe in the
user's PATH.
---
 lisp/org.el |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 63ce2de..2f3cfb1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -106,21 +106,22 @@ With prefix arg HERE, insert it at point."
 	 (git-version)
 	 (dir (concat (file-name-directory (locate-library "org")) "../" ))
 	 (version))
-    (if (file-exists-p (expand-file-name ".git" dir))
+    (if (and (file-exists-p (expand-file-name ".git" dir))
+	     (executable-find "git"))
 	(let ((pwd (substring (pwd) 10)))
 	  (cd dir)
-	  (shell-command "git describe --abbrev=4 HEAD")
-	  (save-excursion
-	    (set-buffer "*Shell Command Output*")
-	    (goto-char (point-min))
-	    (re-search-forward "[^\n]+")
-	    (setq git-version (match-string 0))
-	    (subst-char-in-string ?- ?. git-version t)
-	    (shell-command "git diff-index --name-only HEAD --")
-	    (unless (eql 1 (point-max))
-	      (setq git-version (concat git-version ".dirty")))
-	    (setq org-version (concat org-version " (" git-version ")")))
-	  (cd pwd)))
+	  (if (eql 0 (shell-command "git describe --abbrev=4 HEAD"))
+	      (save-excursion
+		(set-buffer "*Shell Command Output*")
+		(goto-char (point-min))
+		(re-search-forward "[^\n]+")
+		(setq git-version (match-string 0))
+		(subst-char-in-string ?- ?. git-version t)
+		(shell-command "git diff-index --name-only HEAD --")
+		(unless (eql 1 (point-max))
+		  (setq git-version (concat git-version ".dirty")))
+		(setq org-version (concat org-version " (" git-version ")")))
+	    (cd pwd))))
     (setq version (format "Org-mode version %s" org-version))
     (if here (insert version))
     (message version)
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] org-version fix for windows
  2009-08-19 20:06                                         ` [PATCH 0/2] org-version fix for windows Bernt Hansen
@ 2009-08-20  3:54                                           ` Bernt Hansen
  2009-08-20 19:06                                             ` Bernt Hansen
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-20  3:54 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten,

Please do NOT apply these patches yet.  Manish reported a problem with
them on his system.  I'll post improved ones tomorrow.

Thanks,
Bernt


Bernt Hansen <bernt@norang.ca> writes:

> Here are two patches which fix org-version for windows.
>
> This should handle cygwin and msysGit where git is installed for use
> by the default Windows command shell.  This does not currently support
> msysGit where git is not installed in the user's PATH.
>
> The series is available at git://git.norang.ca/org-mode for-carsten
>
> Bernt Hansen (2):
>   Use lisp cd function to change directories to avoid shell
>     dependencies
>   Skip git-version determination if git command fails
>
>  lisp/org.el |   42 +++++++++++++++++++++++-------------------
>  1 files changed, 23 insertions(+), 19 deletions(-)
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] org-version fix for windows
  2009-08-20  3:54                                           ` Bernt Hansen
@ 2009-08-20 19:06                                             ` Bernt Hansen
  2009-08-20 19:53                                               ` Carsten Dominik
  0 siblings, 1 reply; 43+ messages in thread
From: Bernt Hansen @ 2009-08-20 19:06 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi Carsten,

As it turns out these patches are okay.  Manish retested them on his
system today and they work.

Please apply.

Both of these commits are available at git://git.norang.ca/org-mode
for-carsten

Regards,
Bernt

PS: Manish> Thanks for testing!!

Bernt Hansen <bernt@norang.ca> writes:

> Carsten,
>
> Please do NOT apply these patches yet.  Manish reported a problem with
> them on his system.  I'll post improved ones tomorrow.
>
> Thanks,
> Bernt
>
>
> Bernt Hansen <bernt@norang.ca> writes:
>
>> Here are two patches which fix org-version for windows.
>>
>> This should handle cygwin and msysGit where git is installed for use
>> by the default Windows command shell.  This does not currently support
>> msysGit where git is not installed in the user's PATH.
>>
>> The series is available at git://git.norang.ca/org-mode for-carsten
>>
>> Bernt Hansen (2):
>>   Use lisp cd function to change directories to avoid shell
>>     dependencies
>>   Skip git-version determination if git command fails
>>
>>  lisp/org.el |   42 +++++++++++++++++++++++-------------------
>>  1 files changed, 23 insertions(+), 19 deletions(-)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/2] org-version fix for windows
  2009-08-20 19:06                                             ` Bernt Hansen
@ 2009-08-20 19:53                                               ` Carsten Dominik
  0 siblings, 0 replies; 43+ messages in thread
From: Carsten Dominik @ 2009-08-20 19:53 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Carsten Dominik, emacs-orgmode

Applied, thanks

- Carsten

On Aug 20, 2009, at 8:06 PM, Bernt Hansen wrote:

> Hi Carsten,
>
> As it turns out these patches are okay.  Manish retested them on his
> system today and they work.
>
> Please apply.
>
> Both of these commits are available at git://git.norang.ca/org-mode
> for-carsten
>
> Regards,
> Bernt
>
> PS: Manish> Thanks for testing!!
>
> Bernt Hansen <bernt@norang.ca> writes:
>
>> Carsten,
>>
>> Please do NOT apply these patches yet.  Manish reported a problem  
>> with
>> them on his system.  I'll post improved ones tomorrow.
>>
>> Thanks,
>> Bernt
>>
>>
>> Bernt Hansen <bernt@norang.ca> writes:
>>
>>> Here are two patches which fix org-version for windows.
>>>
>>> This should handle cygwin and msysGit where git is installed for use
>>> by the default Windows command shell.  This does not currently  
>>> support
>>> msysGit where git is not installed in the user's PATH.
>>>
>>> The series is available at git://git.norang.ca/org-mode for-carsten
>>>
>>> Bernt Hansen (2):
>>>  Use lisp cd function to change directories to avoid shell
>>>    dependencies
>>>  Skip git-version determination if git command fails
>>>
>>> lisp/org.el |   42 +++++++++++++++++++++++-------------------
>>> 1 files changed, 23 insertions(+), 19 deletions(-)

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2009-08-20 19:53 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-18 17:22 [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
2009-08-18 17:22 ` [PATCH 1/2] Add git version number to org-version information Bernt Hansen
2009-08-18 17:22 ` [PATCH 2/2] Add .dirty to git org-version info if files are modified Bernt Hansen
2009-08-18 19:08 ` [PATCH 0/2] Teach org-version to include git version information Carsten Dominik
2009-08-18 19:10   ` Bernt Hansen
2009-08-18 19:15     ` Carsten Dominik
2009-08-18 19:30       ` Stefan Vollmar
2009-08-18 19:44         ` Bernt Hansen
2009-08-18 19:48           ` Stefan Vollmar
2009-08-19 10:10       ` Manish
2009-08-19 11:24         ` Bernt Hansen
2009-08-19 12:01           ` Manish
2009-08-19 12:08             ` Bernt Hansen
2009-08-19 12:19               ` Manish
2009-08-19 12:30                 ` Bernt Hansen
2009-08-19 13:20                   ` Manish
2009-08-19 13:32                     ` Bernt Hansen
2009-08-19 13:34                       ` Bernt Hansen
2009-08-19 13:58                       ` Manish
2009-08-19 14:02                       ` Nick Dokos
2009-08-19 14:16                         ` Manish
2009-08-19 14:29                           ` Nick Dokos
2009-08-19 14:42                             ` Bernt Hansen
2009-08-19 14:51                               ` Manish
2009-08-19 15:04                                 ` Nick Dokos
2009-08-19 15:10                                   ` Manish
2009-08-19 15:16                                   ` Bernt Hansen
2009-08-19 15:23                                     ` Manish
2009-08-19 15:27                                       ` Bernt Hansen
2009-08-19 20:06                                         ` [PATCH 0/2] org-version fix for windows Bernt Hansen
2009-08-20  3:54                                           ` Bernt Hansen
2009-08-20 19:06                                             ` Bernt Hansen
2009-08-20 19:53                                               ` Carsten Dominik
2009-08-19 20:06                                         ` [PATCH 1/2] Use lisp cd function to change directories to avoid shell dependencies Bernt Hansen
2009-08-19 20:06                                         ` [PATCH 2/2] Skip git-version determination if git command fails Bernt Hansen
2009-08-19 14:17                         ` [PATCH 0/2] Teach org-version to include git version information Bernt Hansen
2009-08-19 14:41                           ` Manish
2009-08-19 14:44                             ` Bernt Hansen
2009-08-19 13:22               ` Manish
2009-08-19 13:40                 ` Bernt Hansen
2009-08-19 13:57                   ` Nick Dokos
2009-08-19 12:21         ` Nick Dokos
2009-08-19 12:30           ` Manish

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).