summaryrefslogtreecommitdiff
path: root/lisp/net/dictionary-connection.el
diff options
context:
space:
mode:
authorTorsten Hilbrich <torsten.hilbrich@gmx.net>2020-12-14 09:48:26 +0100
committerTorsten Hilbrich <torsten.hilbrich@gmx.net>2020-12-14 11:45:24 +0100
commita25a12ddaf61389030a1afaa535d5563856cfc70 (patch)
tree3149d10de7a7a4118423a5996ae442e243f9c37b /lisp/net/dictionary-connection.el
parentd30618cbc11fb33a0d55c54200eb45f39251189c (diff)
downloademacs-a25a12ddaf61389030a1afaa535d5563856cfc70.tar.gz
emacs-a25a12ddaf61389030a1afaa535d5563856cfc70.tar.bz2
emacs-a25a12ddaf61389030a1afaa535d5563856cfc70.zip
Use when where else case returns nil
* lisp/net/dictionary-connection.el (dictionary-connection-status, dictionary-connection-close): Instead of returning nil in the else case of the if just use when. Was suggested by Stefan Kangas.
Diffstat (limited to 'lisp/net/dictionary-connection.el')
-rw-r--r--lisp/net/dictionary-connection.el42
1 files changed, 20 insertions, 22 deletions
diff --git a/lisp/net/dictionary-connection.el b/lisp/net/dictionary-connection.el
index c762b352b75..0d93d978df3 100644
--- a/lisp/net/dictionary-connection.el
+++ b/lisp/net/dictionary-connection.el
@@ -85,31 +85,29 @@ nil: argument is no connection object
'up: connection is open and buffer is existing
'down: connection is closed
'alone: connection is not associated with a buffer"
- (if (dictionary-connection-p connection)
- (let ((process (dictionary-connection-process connection))
- (buffer (dictionary-connection-buffer connection)))
- (if (not process)
- 'none
- (if (not (buffer-live-p buffer))
- 'alone
- (if (not (eq (process-status process) 'open))
- 'down
- 'up))))
- nil))
+ (when (dictionary-connection-p connection)
+ (let ((process (dictionary-connection-process connection))
+ (buffer (dictionary-connection-buffer connection)))
+ (if (not process)
+ 'none
+ (if (not (buffer-live-p buffer))
+ 'alone
+ (if (not (eq (process-status process) 'open))
+ 'down
+ 'up))))))
(defun dictionary-connection-close (connection)
"Force closing of the connection."
- (if (dictionary-connection-p connection)
- (progn
- (let ((buffer (dictionary-connection-buffer connection))
- (process (dictionary-connection-process connection)))
- (if process
- (delete-process process))
- (if buffer
- (kill-buffer buffer))
-
- (dictionary-connection-set-process connection nil)
- (dictionary-connection-set-buffer connection nil)))))
+ (when (dictionary-connection-p connection)
+ (let ((buffer (dictionary-connection-buffer connection))
+ (process (dictionary-connection-process connection)))
+ (if process
+ (delete-process process))
+ (if buffer
+ (kill-buffer buffer))
+
+ (dictionary-connection-set-process connection nil)
+ (dictionary-connection-set-buffer connection nil))))
(defun dictionary-connection-send (connection data)
"Send `data' to the process."