* a patch to make terminal-name to return actual terminal device
@ 2008-04-30 8:32 Daiki Ueno
2008-04-30 9:37 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Daiki Ueno @ 2008-04-30 8:32 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]
Hello,
I'm now trying to improve interactions between Emacs and gpg-agent, on
text-only consoles. See the following post for detail.
From: Richard Stallman <rms@gnu.org>
Subject: Fix needed for communication with gpg-agent
Date: Sat, 17 Feb 2007 15:57:37 -0500
Message-ID: <E1HIWcj-0002DU-Cw@fencepost.gnu.org>
http://article.gmane.org/gmane.emacs.devel/66490
The idea is simple: allow a child process (gpg-agent) to temporarily
access the controlling terminal of Emacs. It can be done by passing the
actual device name (something like "/dev/pts/XX") to the child process.
However, I couldn't find any portable way to do this in Lisp level. The
function terminal-name always returns "/dev/tty" on GNU/Linux.
So I'd like to propose a change of terminal-name to return the actual
device file name. I'll attach a couple of files in this mail. One is
the patch, and another is a test-case which directly interacts with
pinentry-curses (which is a subprogram used by gpg-agent), within Emacs.
In this patch, I assumed that terminal->name (in C) is only used for
informational purposes. Please correct me if I am wrong.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ttyname.diff --]
[-- Type: text/x-diff, Size: 879 bytes --]
diff --git a/configure.in b/configure.in
index 4740fb9..2285b58 100644
--- a/configure.in
+++ b/configure.in
@@ -2322,6 +2322,8 @@ AC_CHECK_FUNCS(getpt)
# than to expect to find it in ncurses.
AC_CHECK_LIB(ncurses, tparm)
+AC_CHECK_FUNCS(ttyname)
+
# Do we have res_init, for detecting changes in /etc/resolv.conf?
resolv=no
diff --git a/src/term.c b/src/term.c
index 4e63568..fe1edd0 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3351,7 +3351,16 @@ init_tty (char *name, char *terminal_type, int must_succeed)
file = fdopen (fd, "w+");
tty->name = xstrdup (name);
- terminal->name = xstrdup (name);
+
+#if HAVE_TTYNAME
+ if (ctty)
+ {
+ char *ctty_name = ttyname (0);
+ terminal->name = xstrdup (ctty_name ? ctty_name : name);
+ }
+ else
+#endif
+ terminal->name = xstrdup (name);
tty->input = file;
tty->output = file;
}
[-- Attachment #3: pinentry-curses-test.el --]
[-- Type: application/emacs-lisp, Size: 923 bytes --]
[-- Attachment #4: Type: text/plain, Size: 25 bytes --]
Regards,
--
Daiki Ueno
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: a patch to make terminal-name to return actual terminal device
2008-04-30 8:32 a patch to make terminal-name to return actual terminal device Daiki Ueno
@ 2008-04-30 9:37 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2008-04-30 9:37 UTC (permalink / raw)
To: Daiki Ueno; +Cc: emacs-devel
> In this patch, I assumed that terminal->name (in C) is only used for
> informational purposes. Please correct me if I am wrong.
I believe you're partly right, but partly wrong as well.
I remember bumping into something closely related when working on the
gpm support. So please check that code as well.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-30 9:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30 8:32 a patch to make terminal-name to return actual terminal device Daiki Ueno
2008-04-30 9:37 ` Stefan Monnier
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.