all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* server-eval-and-print only returns non-nil values
@ 2011-07-03 13:38 Juanma Barranquero
  2011-07-03 13:57 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Juanma Barranquero @ 2011-07-03 13:38 UTC (permalink / raw
  To: Emacs developers

Is there any reason why server-eval-and-print only returns non-nil values?

  C:\> emacsclient -e "(file-exists-p \"C:/\")"
  t

  C:> emacsclient -e "(file-exists-p \"Z:/\")"

  C:>


If not, I'd like to fix it with the trivial patch below.

    Juanma



2011-07-03  Juanma Barranquero  <lekktu@gmail.com>

	* server.el (server-eval-and-print): Return any result, even nil.


=== modified file 'lisp/server.el'
--- lisp/server.el	2011-06-25 18:05:48 +0000
+++ lisp/server.el	2011-07-03 13:33:25 +0000
@@ -679,7 +679,7 @@
 (defun server-eval-and-print (expr proc)
   "Eval EXPR and send the result back to client PROC."
   (let ((v (eval (car (read-from-string expr)))))
-    (when (and v proc)
+    (when proc
       (with-temp-buffer
         (let ((standard-output (current-buffer)))
           (pp v)



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

* Re: server-eval-and-print only returns non-nil values
  2011-07-03 13:38 server-eval-and-print only returns non-nil values Juanma Barranquero
@ 2011-07-03 13:57 ` Lars Magne Ingebrigtsen
  2011-07-04  0:52   ` Juanma Barranquero
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-03 13:57 UTC (permalink / raw
  To: emacs-devel

Juanma Barranquero <lekktu@gmail.com> writes:

> Is there any reason why server-eval-and-print only returns non-nil values?
>
>   C:\> emacsclient -e "(file-exists-p \"C:/\")"
>   t
>
>   C:> emacsclient -e "(file-exists-p \"Z:/\")"
>
>   C:>
>
> If not, I'd like to fix it with the trivial patch below.

Yeah, that confused me, too.

It's possible that such a change will break some scripts here and there,
but that may not be very likely...

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




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

* Re: server-eval-and-print only returns non-nil values
  2011-07-03 13:57 ` Lars Magne Ingebrigtsen
@ 2011-07-04  0:52   ` Juanma Barranquero
  0 siblings, 0 replies; 3+ messages in thread
From: Juanma Barranquero @ 2011-07-04  0:52 UTC (permalink / raw
  To: emacs-devel

On Sun, Jul 3, 2011 at 15:57, Lars Magne Ingebrigtsen <larsi@gnus.org> wrote:

> It's possible that such a change will break some scripts here and there,
> but that may not be very likely...

If they break, is because they are using undocumented behavior,
because AFAICS neither "emacsclient -h"

  -e, --eval              Evaluate the FILE arguments as ELisp expressions

nor section 38.2 "`emacsclient' Options" of the Emacs manual

  `-e'
  `--eval'
       Tell Emacs to evaluate some Emacs Lisp code, instead of visiting
       some files.  When this option is given, the arguments to
       `emacsclient' are interpreted as a list of expressions to
       evaluate, _not_ as a list of files to visit.

say anything about return values.

So I think I'll check in the change and wait for the breakage.

    Juanma



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

end of thread, other threads:[~2011-07-04  0:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-03 13:38 server-eval-and-print only returns non-nil values Juanma Barranquero
2011-07-03 13:57 ` Lars Magne Ingebrigtsen
2011-07-04  0:52   ` Juanma Barranquero

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.