From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michal Nazarewicz Newsgroups: gmane.emacs.devel Subject: [PATCHv4 4/4] Simplify conditional expression in `find-file-noselect'. Date: Mon, 24 Jun 2013 14:35:48 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1372077443 24728 80.91.229.3 (24 Jun 2013 12:37:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Jun 2013 12:37:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 24 14:37:25 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ur61K-00046x-Vb for ged-emacs-devel@m.gmane.org; Mon, 24 Jun 2013 14:37:23 +0200 Original-Received: from localhost ([::1]:38620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur61K-0001ty-JT for ged-emacs-devel@m.gmane.org; Mon, 24 Jun 2013 08:37:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur60Y-0000Bx-Ly for emacs-devel@gnu.org; Mon, 24 Jun 2013 08:36:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur60R-0004ix-M7 for emacs-devel@gnu.org; Mon, 24 Jun 2013 08:36:34 -0400 Original-Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:42905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur60R-0004gC-Dn for emacs-devel@gnu.org; Mon, 24 Jun 2013 08:36:27 -0400 Original-Received: by mail-la0-f52.google.com with SMTP id fo12so10282414lab.39 for ; Mon, 24 Jun 2013 05:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references; bh=FvuF8ZzLUuAN6oXI8UWdnFz+Fq9JHFnGWrIt6MzEz7c=; b=l/rgQYGBQoB8ByQyfTmPU0nQsnkGT4k1kIh9seoZGCtQH1U9dG23frRbtUqDZvp7ZJ Frw4WAiX4SDk2n0Ex8NNLoSPW0BiF+Xzez9zu9iIYtwirfOZYhoSYw6kkj40uN9mLi7m 3eJ8S/NJJdpLmfPsPJHuqC8DVZhjxbwOFBK14wSlzBNUpzTzuJP8O8XKeHYYe4hjdt6V aKZHgHMb98STWQ2wXQp3UnPL/KvMfvqQ8t2v8Nb6GZM3noxXiyxFNbSJH9E65vxArCGG D/25POrPZ4zQZLjrHKFmaYAVT66YBDOrb3wqkayaU1gQe0HnctEVrTpEAGsPN91arN5/ krmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=FvuF8ZzLUuAN6oXI8UWdnFz+Fq9JHFnGWrIt6MzEz7c=; b=AUmeIsMKLfERrjTFQ/VVyMQu2MJUETpktGIg9UQgyfmtRxNMnPbieN1LhGTx4bXIVL Ee+qC5UCJqgU3ZXo1/5d9YVwuQPvRsKKK0jKYtkCWL2slWwxfOBbpZsfMxz1aqubUHdd GOTW7Ed0/IUPHbcZcpdnnkq6FlgjdGFg6sUbcYDBr1yWWXuKID6Mqs+u4u4LMXitufUg o2qZ3IcJCBlPysaK2hKXnbvwEBZcfSyrt2qwX7U1EJfKwBs5EDBLXjEsoboW03bCNMgJ zEjEInlCNWX903Tnwdr1Sw3BSVSAq8Nc/NIbnGNQwUD2+9fxcy6FT6AIwCkvcZEfvxsd kF/Q== X-Received: by 10.112.28.48 with SMTP id y16mr12958057lbg.37.1372077386412; Mon, 24 Jun 2013 05:36:26 -0700 (PDT) Original-Received: from mpn-glaptop.corp.google.com ([2620:0:105f:301:2ddc:c978:be37:615e]) by mx.google.com with ESMTPSA id u1sm6672296lag.5.2013.06.24.05.36.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Jun 2013 05:36:25 -0700 (PDT) X-Mailer: git-send-email 1.8.3.1 In-Reply-To: In-Reply-To: Original-References: X-Gm-Message-State: ALoCoQktIxO6fG+wFxpdrxhIyeCwvhRkn2G/Tk64natPCZISH1BGOAa6Hl1NHjEXfKqIoSpcDKM0X8TcxfIpqdLk8vYNoP7f2KHKi1YILVEyNut31PI/vlaNfOp32ompSVok/2TGVexZnmycaBnlb8Gze49IJBz276+TnXv93cNH5Cc7g04N0kyOH3ve24HpnQNdmQf2dECk X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160934 Archived-At: 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 + * files.el (find-file-noselect): Simplify conditional expression. + +2013-06-24 Michal Nazarewicz + 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