[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/integration-of-dictionary-el a25a12d 12/17: Use when where else
From: |
Torsten Hilbrich |
Subject: |
feature/integration-of-dictionary-el a25a12d 12/17: Use when where else case returns nil |
Date: |
Mon, 14 Dec 2020 05:46:39 -0500 (EST) |
branch: feature/integration-of-dictionary-el
commit a25a12ddaf61389030a1afaa535d5563856cfc70
Author: Torsten Hilbrich <torsten.hilbrich@gmx.net>
Commit: Torsten Hilbrich <torsten.hilbrich@gmx.net>
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.
---
lisp/net/dictionary-connection.el | 42 +++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/lisp/net/dictionary-connection.el
b/lisp/net/dictionary-connection.el
index c762b35..0d93d97 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."
- feature/integration-of-dictionary-el updated (7ca331a -> 62d14e1), Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el a25a12d 12/17: Use when where else case returns nil,
Torsten Hilbrich <=
- feature/integration-of-dictionary-el ffa7d66 09/17: * lisp/net/dictionary.el: Prefer defsubst over defmacro, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el a557a10 08/17: * lisp/net/dictionary-connection.el: Prefer defsubst, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el f584437 06/17: * lisp/net/dictionary-connection.el: Remove obsolete Version, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el 54a3964 07/17: Update GPL version, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el d5a4da2 01/17: * lisp/net/dictionary.el: Remove remnants of package, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el cc5f280 02/17: * lisp/net/dictionary.el: Add lexical-binding:t, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el 81ebe86 04/17: Show error message when asking to match for nothing, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el 09952ce 03/17: Removed useless check for popup-menu, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el 4deb861 10/17: * lisp/net/dictionary.el (dictionary-mode): Use setq-local, Torsten Hilbrich, 2020/12/14
- feature/integration-of-dictionary-el 0044a2e 05/17: * lisp/net/dictionary-connection.el: Add lexical-binding:t, Torsten Hilbrich, 2020/12/14