all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michal Nazarewicz <mpn@google.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: [PATCHv5 4/4] Simplify conditional expression in `find-file-noselect'.
Date: Fri, 28 Jun 2013 16:40:55 +0200	[thread overview]
Message-ID: <2d6b18838944565054a1a46a4f5d41b9db0566b5.1372429581.git.mina86@mina86.com> (raw)
In-Reply-To: <cover.1372429581.git.mina86@mina86.com>
In-Reply-To: <cover.1372429581.git.mina86@mina86.com>

From: Michal Nazarewicz <mina86@mina86.com>

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 983e0a4..efcd679 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -10,6 +10,10 @@
 
 2013-06-28  Michal Nazarewicz  <mina86@mina86.com>
 
+	* files.el (find-file-noselect): Simplify conditional expression.
+
+2013-06-28  Michal Nazarewicz  <mina86@mina86.com>
+
 	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




      parent reply	other threads:[~2013-06-28 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 14:40 [PATCHv5 0/4] Add remember-notes function, take four Michal Nazarewicz
2013-06-28 14:40 ` [PATCHv5 1/4] `kill-buffer' runs query functions before checking buffer modification Michal Nazarewicz
2013-06-28 14:40 ` [PATCHv5 2/4] Add `remember-notes' function to store notes across Emacs restarts Michal Nazarewicz
2013-06-28 14:40 ` [PATCHv5 3/4] `remember-append-to-file' appending to buffer bug fix Michal Nazarewicz
2013-06-28 14:40 ` Michal Nazarewicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d6b18838944565054a1a46a4f5d41b9db0566b5.1372429581.git.mina86@mina86.com \
    --to=mpn@google.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.