all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bash/readline emacs mode help
@ 2013-06-27  9:14 C K Kashyap
  2013-06-27  9:30 ` Teemu Likonen
  0 siblings, 1 reply; 8+ messages in thread
From: C K Kashyap @ 2013-06-27  9:14 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi,

In bash (I presume, this really comes from readline implementation), I can
set the input mode to vi saying set -o vi
One of the things I get with this mode is the ability to open up vi to edit
a command line (using Escape v) - This is particularly useful if I have to
change "slashes" in a path.

I was wondering if there is an equivalent in emacs mode?

Regards,
Kashyap


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

* Re: bash/readline emacs mode help
  2013-06-27  9:14 bash/readline emacs mode help C K Kashyap
@ 2013-06-27  9:30 ` Teemu Likonen
  2013-06-27 13:17   ` J. David Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: Teemu Likonen @ 2013-06-27  9:30 UTC (permalink / raw)
  To: C. K. Kashyap; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

C. K. Kashyap [2013-06-27 14:44:21 +05:30] wrote:

> One of the things I get with this mode is the ability to open up vi to
> edit a command line (using Escape v) [...]
>
> I was wondering if there is an equivalent in emacs mode?

In Emacs editing mode the key "C-x C-e" (edit-and-execute-command) opens
the text editor defined in $VISUAL or $EDITOR variables (or "emacs").

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: bash/readline emacs mode help
  2013-06-27  9:30 ` Teemu Likonen
@ 2013-06-27 13:17   ` J. David Boyd
  2013-06-27 13:24     ` J. David Boyd
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: J. David Boyd @ 2013-06-27 13:17 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

> C. K. Kashyap [2013-06-27 14:44:21 +05:30] wrote:
>
>> One of the things I get with this mode is the ability to open up vi to
>> edit a command line (using Escape v) [...]
>>
>> I was wondering if there is an equivalent in emacs mode?
>
> In Emacs editing mode the key "C-x C-e" (edit-and-execute-command) opens
> the text editor defined in $VISUAL or $EDITOR variables (or "emacs").

Doesn't seem all that useful though.  I have my $EDITOR set to be
"emacsclient -n", which doesn't work at all in this circumstance.

If I get rid of the '-n' it works fine, but I'm not doing that....




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

* Re: bash/readline emacs mode help
  2013-06-27 13:17   ` J. David Boyd
@ 2013-06-27 13:24     ` J. David Boyd
       [not found]     ` <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>
  2013-06-29 16:05     ` C K Kashyap
  2 siblings, 0 replies; 8+ messages in thread
From: J. David Boyd @ 2013-06-27 13:24 UTC (permalink / raw)
  To: help-gnu-emacs

david@adboyd.com (J. David Boyd) writes:

> Teemu Likonen <tlikonen@iki.fi> writes:
>
>> C. K. Kashyap [2013-06-27 14:44:21 +05:30] wrote:
>>
>>> One of the things I get with this mode is the ability to open up vi to
>>> edit a command line (using Escape v) [...]
>>>
>>> I was wondering if there is an equivalent in emacs mode?
>>
>> In Emacs editing mode the key "C-x C-e" (edit-and-execute-command) opens
>> the text editor defined in $VISUAL or $EDITOR variables (or "emacs").
>
> Doesn't seem all that useful though.  I have my $EDITOR set to be
> "emacsclient -n", which doesn't work at all in this circumstance.
>
> If I get rid of the '-n' it works fine, but I'm not doing that....


Hmm, should have clarified.   Yes, emacsclient works perfectly, opening up the
command line in a new emacs buffer.   But the '-n' breaks the connection to
the command line, so even though I can edit it to my heart's content, there is
no way to have it fed back to the waiting command line.

Dave




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

* Re: bash/readline emacs mode help
       [not found]     ` <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>
@ 2013-06-27 15:27       ` Barry Margolin
  2013-06-27 17:49         ` J. David Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: Barry Margolin @ 2013-06-27 15:27 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>,
 david@adboyd.com (J. David Boyd) wrote:

> david@adboyd.com (J. David Boyd) writes:
> 
> > Teemu Likonen <tlikonen@iki.fi> writes:
> >
> >> C. K. Kashyap [2013-06-27 14:44:21 +05:30] wrote:
> >>
> >>> One of the things I get with this mode is the ability to open up vi to
> >>> edit a command line (using Escape v) [...]
> >>>
> >>> I was wondering if there is an equivalent in emacs mode?
> >>
> >> In Emacs editing mode the key "C-x C-e" (edit-and-execute-command) opens
> >> the text editor defined in $VISUAL or $EDITOR variables (or "emacs").
> >
> > Doesn't seem all that useful though.  I have my $EDITOR set to be
> > "emacsclient -n", which doesn't work at all in this circumstance.
> >
> > If I get rid of the '-n' it works fine, but I'm not doing that....
> 
> 
> Hmm, should have clarified.   Yes, emacsclient works perfectly, opening up the
> command line in a new emacs buffer.   But the '-n' breaks the connection to
> the command line, so even though I can edit it to my heart's content, there is
> no way to have it fed back to the waiting command line.
> 
> Dave

Why would you put -n in $EDITOR? This is mostly used by programs that 
want to invoke an editor on a temp file and then do something when 
you're done editing it, such as "crontab -e", "vipw", or readline's C-x 
C-e.  So it should always be set to a command that waits.

Maybe you're trying to deal with Emacs deadlocking if you use one of 
these commands from M-! inside Emacs? The solution in this case is to 
background the command with &.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: bash/readline emacs mode help
  2013-06-27 15:27       ` Barry Margolin
@ 2013-06-27 17:49         ` J. David Boyd
  2013-06-28 10:30           ` Thien-Thi Nguyen
  0 siblings, 1 reply; 8+ messages in thread
From: J. David Boyd @ 2013-06-27 17:49 UTC (permalink / raw)
  To: help-gnu-emacs

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>,
>  david@adboyd.com (J. David Boyd) wrote:
>
>> david@adboyd.com (J. David Boyd) writes:
>> 
>> > Teemu Likonen <tlikonen@iki.fi> writes:
>> >
>> >> C. K. Kashyap [2013-06-27 14:44:21 +05:30] wrote:
>> >>
>> >>> One of the things I get with this mode is the ability to open up vi to
>> >>> edit a command line (using Escape v) [...]
>> >>>
>> >>> I was wondering if there is an equivalent in emacs mode?
>> >>
>> >> In Emacs editing mode the key "C-x C-e" (edit-and-execute-command) opens
>> >> the text editor defined in $VISUAL or $EDITOR variables (or "emacs").
>> >
>> > Doesn't seem all that useful though.  I have my $EDITOR set to be
>> > "emacsclient -n", which doesn't work at all in this circumstance.
>> >
>> > If I get rid of the '-n' it works fine, but I'm not doing that....
>> 
>> 
>> Hmm, should have clarified.   Yes, emacsclient works perfectly, opening up the
>> command line in a new emacs buffer.   But the '-n' breaks the connection to
>> the command line, so even though I can edit it to my heart's content, there is
>> no way to have it fed back to the waiting command line.
>> 
>> Dave
>
> Why would you put -n in $EDITOR? This is mostly used by programs that 
> want to invoke an editor on a temp file and then do something when 
> you're done editing it, such as "crontab -e", "vipw", or readline's C-x 
> C-e.  So it should always be set to a command that waits.
>
> Maybe you're trying to deal with Emacs deadlocking if you use one of 
> these commands from M-! inside Emacs? The solution in this case is to 
> background the command with &.

Because I always have emacs running.  And I didn't want to have to C-x # to
get a command shell prompt back.

Guess I'll have to change my process.   I can leave $EDITOR=emacsclient, and
have an alias for 'emacsclient -n' when I want to call it directly.

Yeah, that will work.

Thanks for this thread, I think my workflow just got better.

Dave




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

* Re: bash/readline emacs mode help
  2013-06-27 17:49         ` J. David Boyd
@ 2013-06-28 10:30           ` Thien-Thi Nguyen
  0 siblings, 0 replies; 8+ messages in thread
From: Thien-Thi Nguyen @ 2013-06-28 10:30 UTC (permalink / raw)
  To: J. David Boyd; +Cc: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 206 bytes --]

Tangentially, i find using Emacs for scripting (i.e., invoked with
‘--script’) is nicer if it has the ability to display stuff to stdout.
FWIW, here is a patch that adds ‘emacs-exit-messages’:


[-- Attachment #1.2: emacs-exit-messages.diff --]
[-- Type: text/x-diff, Size: 2265 bytes --]

commit da997204ccac1513452e801e974cf56895f15486
Author: Thien-Thi Nguyen <ttn@gnuvola.org>
Date:   2012-07-31 22:18:28 +0200

    Add var ‘emacs-exit-messages’ and handle it during shutdown.

    * emacs.c (shut_down_emacs): After resetting the tty, display
    any strings specified by ‘emacs-exit-messages’ to stderr/stdout.
    (syms_of_emacs Vemacs_exit_messages): New DEFVAR_LISP.
---
 src/emacs.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/emacs.c b/src/emacs.c
index 13f6d11..6df4f12 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1920,6 +1920,30 @@ shut_down_emacs (int sig, Lisp_Object stuff)
   reset_all_sys_modes ();
 #endif

+  /* If there are any messages, display them now.
+     Silently ignore ill-formed data, which is a latent bug.  */
+  while (CONSP (Vemacs_exit_messages))
+    {
+      Lisp_Object msg = Fcar (Vemacs_exit_messages);
+      FILE *to = stderr;
+
+      if (CONSP (msg) && INTEGERP (Fcar (msg)))
+        {
+          if (1 == XINT (Fcar (msg)))
+            to = stdout;
+          msg = Fcdr (msg);
+        }
+      if (STRINGP (msg))
+        {
+          size_t expected = SBYTES (msg);
+          size_t actually = fwrite (SDATA (msg), 1, expected, to);
+
+          if (expected > actually)
+            abort ();
+        }
+      Vemacs_exit_messages = Fcdr (Vemacs_exit_messages);
+    }
+
   stuff_buffered_input (stuff);

   inhibit_sentinels = 1;
@@ -2314,6 +2338,14 @@ Before Emacs 24.1, the hook was not run in batch mode, i.e., if
 `noninteractive' was non-nil.  */);
   Vkill_emacs_hook = Qnil;

+  DEFVAR_LISP ("emacs-exit-messages", Vemacs_exit_messages,
+               doc: /* List of strings to display to stderr at exit.
+These are output as-is, so you need to include a newline.
+Each element may also have form (FD . STRING), where FD is
+a small integer: 1 for standard output, 2 for standard error.
+All other FD values are taken as 2.  */);
+  Vemacs_exit_messages = Qnil;
+
   DEFVAR_LISP ("path-separator", Vpath_separator,
 	       doc: /* String containing the character that separates directories in
 search paths, such as PATH and other similar environment variables.  */);

[-- Attachment #1.3: Type: text/plain, Size: 172 bytes --]


It was written a while back, so i'd love to learn that is is obsoleted
since then by some workalike feature.  But if not...

-- 
Thien-Thi Nguyen
GPG key: 4C807502

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: bash/readline emacs mode help
  2013-06-27 13:17   ` J. David Boyd
  2013-06-27 13:24     ` J. David Boyd
       [not found]     ` <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>
@ 2013-06-29 16:05     ` C K Kashyap
  2 siblings, 0 replies; 8+ messages in thread
From: C K Kashyap @ 2013-06-29 16:05 UTC (permalink / raw)
  To: J. David Boyd; +Cc: help-gnu-emacs@gnu.org

Thanks David -- I should've tried EDITOR first :)

Regards,
Kashyap


On Thu, Jun 27, 2013 at 6:47 PM, J. David Boyd <david@adboyd.com> wrote:

> Teemu Likonen <tlikonen@iki.fi> writes:
>
> > C. K. Kashyap [2013-06-27 14:44:21 +05:30] wrote:
> >
> >> One of the things I get with this mode is the ability to open up vi to
> >> edit a command line (using Escape v) [...]
> >>
> >> I was wondering if there is an equivalent in emacs mode?
> >
> > In Emacs editing mode the key "C-x C-e" (edit-and-execute-command) opens
> > the text editor defined in $VISUAL or $EDITOR variables (or "emacs").
>
> Doesn't seem all that useful though.  I have my $EDITOR set to be
> "emacsclient -n", which doesn't work at all in this circumstance.
>
> If I get rid of the '-n' it works fine, but I'm not doing that....
>
>
>


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

end of thread, other threads:[~2013-06-29 16:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-27  9:14 bash/readline emacs mode help C K Kashyap
2013-06-27  9:30 ` Teemu Likonen
2013-06-27 13:17   ` J. David Boyd
2013-06-27 13:24     ` J. David Boyd
     [not found]     ` <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>
2013-06-27 15:27       ` Barry Margolin
2013-06-27 17:49         ` J. David Boyd
2013-06-28 10:30           ` Thien-Thi Nguyen
2013-06-29 16:05     ` C K Kashyap

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.