Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread jaalto
On 2012-01-11 03:31, Sitaram Chamarty wrote:
| On Wed, Jan 11, 2012 at 12:12 AM, Jari Aalto jari.aa...@cante.net wrote:
|  retitle 653968 [PATCH] gitolite: gl-setup doesn't warn it opens another 
editor (Emacs M-x shell)
|  forwarded 653968 Sitaram Chamarty sitar...@gmail.com
|  thanks
| 
|  Sitaram, could you apply this patch to fix Debian bug:
| 
|     http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653968
| 
| Sorry but this does not make any sense to me. 

Doesn't make sense how? What part of it?

The patch adds additional check for two environment variables before
the incident. Very simple test to check if Emacs is in use and take
actions according to it.

Jari



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread Sitaram Chamarty
On Wed, Jan 11, 2012 at 1:59 PM, jaalto jari.aa...@cante.net wrote:
 On 2012-01-11 03:31, Sitaram Chamarty wrote:
 | On Wed, Jan 11, 2012 at 12:12 AM, Jari Aalto jari.aa...@cante.net wrote:
 |  retitle 653968 [PATCH] gitolite: gl-setup doesn't warn it opens another 
 editor (Emacs M-x shell)
 |  forwarded 653968 Sitaram Chamarty sitar...@gmail.com
 |  thanks
 | 
 |  Sitaram, could you apply this patch to fix Debian bug:
 | 
 |     http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653968
 |
 | Sorry but this does not make any sense to me.

 Doesn't make sense how? What part of it?

 The patch adds additional check for two environment variables before
 the incident. Very simple test to check if Emacs is in use and take
 actions according to it.

Doesn't make sense to do such extremely specific platform checks inside code.

You have the -q option -- which, once again, I apologise for not
having documented but I now have (and I appreciate you causing it to
come to my notice that it was not documented).

If you're in an environment where you can't popup an editor, use the
-q option.  Simple.

Please do not email my on this again; I am not going to budge on this.

-- 
Sitaram



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread jaalto
On 2012-01-11 14:03, Sitaram Chamarty wrote:
| On Wed, Jan 11, 2012 at 1:59 PM, jaalto jari.aa...@cante.net wrote:
|  On 2012-01-11 03:31, Sitaram Chamarty wrote:
|  |     http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653968
|  |
|  | Sorry but this does not make any sense to me.
| 
|  The patch adds additional check for two environment variables before
|  the incident. Very simple test to check if Emacs is in use and take
|  actions according to it.
| 
| Doesn't make sense to do such extremely specific platform checks
| inside code.

Are you afraid that the platform checks will increase? Fear not. I
don't know much other cases where people would run gl-setup. There are
only two places for daily command line:

 The terminal and Shell
 The Emacs, inside shell buffer

As you know, Emacs is as big as Vi in user base. Your decision will
affect a lot of users.

The current code makes assumptions about environment that are not
necessarily true.

a) The proposed solution is not complex
b) Not hard to maintain
c) The change is easy to understood
d) There solution is not partial (handles the case as expected)

Wouldn't you want to improve the code for everyone's benefit? This all
quite sensible.

Jari



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread Sitaram Chamarty
sigh

On Wed, Jan 11, 2012 at 2:36 PM, jaalto jari.aa...@cante.net wrote:

 The current code makes assumptions about environment that are not
 necessarily true.

Please just $EDITOR to whatever you want; vi is not the default; it's
the fallback if $EDITOR is not set.

I didn't invent $EDITOR; it's apparently some sort of a convention or
semi-standard.

And once again, please, please, do not respond to me on this specific bug.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread jaalto
On 2012-01-11 14:43, Sitaram Chamarty wrote:
|  The current code makes assumptions about environment that are not
|  necessarily true.
| 
| Please just $EDITOR to whatever you want; vi is not the default; it's
| the fallback if $EDITOR is not set.
| 
| I didn't invent $EDITOR; it's apparently some sort of a convention or
| semi-standard.

Using EDITOR is standard thing. But this is not related to discussion
where program makes assumptions about being run under controlling
terminal.

The least program should do, is to display:

Next, an $EDITOR will be started. Hit enter when ready...

Instead of

hit enter...

Jari



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread Sitaram Chamarty
On Wed, Jan 11, 2012 at 3:39 PM, jaalto jari.aa...@cante.net wrote:

 Using EDITOR is standard thing. But this is not related to discussion
 where program makes assumptions about being run under controlling
 terminal.

That's the first time you mentioned controlling terminal, i.e., more
generic situation than emacs-specific situation.

Please check if 'test -t 0' is sufficient to test this and let me know.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread jaalto
On 2012-01-11 16:37, Sitaram Chamarty wrote:
| Please check if 'test -t 0' is sufficient to test this and let me know.

Under Emacs M-x shell:

  $ test -t 0 ;  echo $?
  0

Jari



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread Sitaram Chamarty
On Wed, Jan 11, 2012 at 5:30 PM, jaalto jari.aa...@cante.net wrote:
 On 2012-01-11 16:37, Sitaram Chamarty wrote:
 | Please check if 'test -t 0' is sufficient to test this and let me know.

 Under Emacs M-x shell:

      $ test -t 0 ;  echo $?
      0

And I know under a normal shell also it says the same.

Well, try fd 1, and possibly fd 2 as well I guess.  I'll also check
around for a way to detect not having a controlling terminal.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-11 Thread jaalto
On 2012-01-11 17:39, Sitaram Chamarty wrote:
| 
| Well, try fd 1, and possibly fd 2 as well I guess.  I'll also check
| around for a way to detect not having a controlling terminal.

Here are the results from Emacs M-x shell:

$ for i in 0 1 2 ; do test -t $i ; echo fd $i status: $? ; done
fd 0 status: 0
fd 1 status: 0
fd 2 status: 0

Jari



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-10 Thread Jari Aalto
retitle 653968 [PATCH] gitolite: gl-setup doesn't warn it opens another editor 
(Emacs M-x shell)
forwarded 653968 Sitaram Chamarty sitar...@gmail.com
thanks

Sitaram, could you apply this patch to fix Debian bug:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653968

Thanks,
Jari

From 60ec5448c5bac4f50d010b2ca3fd9b3f077ab65e Mon Sep 17 00:00:00 2001
From: Jari Aalto jari.aa...@cante.net
Date: Tue, 10 Jan 2012 20:38:04 +0200
Subject: [PATCH] Try multiple editors for editing $GL_RC. Add Emacs check
Organization: Private
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jari Aalto jari.aa...@cante.net
---
 src/gl-setup |   20 ++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/gl-setup b/src/gl-setup
index 3a6c04b..083743a 100755
--- a/src/gl-setup
+++ b/src/gl-setup
@@ -82,9 +82,25 @@ else
 if [ -z $quiet ]
 then
 printf The default settings in the rc file ($GL_RC) are fine for most\n
-printf people but if you wish to make any changes, you can do so now.\n\nhit enter...
+
+	if [ $EMACS ]  [ $INSIDE_EMACS ]; then
+	echo 'Aborted. gl-setup cannot be run under Emacs M-x shell. Would open $EDITOR' 2
+	exit 1
+	fi
+
+printf people but if you wish to make any changes, you can do so now.\n\n
+	echo   hit enter to open file for editing in \$EDITOR...
 read i
-${EDITOR:-vi} $GL_RC
+
+	if [ $EDITOR ]; then
+$EDITOR $GL_RC
+	elif [ -x /usr/bin/sensible-editor ]; then # Debian support
+	/usr/bin/sensible-editor $GL_RC
+	elif [ -x /usr/bin/nano ]; then
+	/usr/bin/nano $GL_RC
+	else
+	vi $GL_RC
+	fi
 fi
 fi
 
-- 
1.7.5.1



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-10 Thread Sitaram Chamarty
On Wed, Jan 11, 2012 at 12:12 AM, Jari Aalto jari.aa...@cante.net wrote:
 retitle 653968 [PATCH] gitolite: gl-setup doesn't warn it opens another 
 editor (Emacs M-x shell)
 forwarded 653968 Sitaram Chamarty sitar...@gmail.com
 thanks

 Sitaram, could you apply this patch to fix Debian bug:

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653968

Sorry but this does not make any sense to me.  If you are running in
an environment where you cannot popup an editor, use -q.

regards

sitaram



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#653968: [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell)

2012-01-10 Thread Sitaram Chamarty
However, I realise now that the -q was not documented.  Sorry about
that; the following documentation changes have now been pushed to both
github and googlecode sites:

https://github.com/sitaramc/gitolite/commit/c15ceeb3eb37666435499d3d7dcb144fbaa0990d

(And although I believe an instruction to rename your pubkey to
YourName.pub ought to be sufficient for most people, I have added
extra verbiage to say *why* they should do so).



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org