[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCHv4 4/4] Simplify conditional expression in `find-file-noselect'.
From: |
Michal Nazarewicz |
Subject: |
[PATCHv4 4/4] Simplify conditional expression in `find-file-noselect'. |
Date: |
Mon, 24 Jun 2013 14:35:48 +0200 |
First of all, (null foo) always returns nil or t, and not is synonym
of null anywaya, so (eq (not (null foo)) (not (null bar))) can be
simplified to (eq (null foo) (null bar)).
Second of all, (and (not foo) (not bar) (not baz)) is the same as (not
(or foo bar baz)).
And then, finally, (when (not foo) bar...) is the same as (unless foo
bar...).
---
lisp/ChangeLog | 4 ++++
lisp/files.el | 13 ++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a7b8fd1..eefceac 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2013-06-24 Michal Nazarewicz <address@hidden>
+ * files.el (find-file-noselect): Simplify conditional expression.
+
+2013-06-24 Michal Nazarewicz <address@hidden>
+
Add `remember-notes' function to store random notes across Emacs
restarts.
* remember.el (remember-data-file): Added :set callback to affect
diff --git a/lisp/files.el b/lisp/files.el
index 871a4b0..e59a9ac 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1859,13 +1859,12 @@ the various files."
(setq buffer-read-only read-only)))
(setq buffer-file-read-only read-only))
- (when (and (not (eq (not (null rawfile))
- (not (null find-file-literally))))
- (not nonexistent)
- ;; It is confusing to ask whether to visit
- ;; non-literally if they have the file in
- ;; hexl-mode or image-mode.
- (not (memq major-mode '(hexl-mode image-mode))))
+ (unless (or (eq (null rawfile) (null find-file-literally))
+ nonexistent
+ ;; It is confusing to ask whether to visit
+ ;; non-literally if they have the file in
+ ;; hexl-mode or image-mode.
+ (memq major-mode '(hexl-mode image-mode)))
(if (buffer-modified-p)
(if (y-or-n-p
(format
--
1.8.3.1
[PATCHv4 3/4] Add `remember-notes' function to store notes across Emacs restarts., Michal Nazarewicz, 2013/06/24
[PATCHv4 4/4] Simplify conditional expression in `find-file-noselect'.,
Michal Nazarewicz <=
Re: [PATCHv4 0/4] Add `remember-notes' function, Stefan Monnier, 2013/06/30