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: [PATCHv5 4/4] Simplify conditional expression in `find-file-noselect'. Date: Fri, 28 Jun 2013 16:40:55 +0200 Message-ID: <2d6b18838944565054a1a46a4f5d41b9db0566b5.1372429581.git.mina86@mina86.com> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1372430489 26466 80.91.229.3 (28 Jun 2013 14:41:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Jun 2013 14:41:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 28 16:41:30 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 1UsZra-0001ZD-NW for ged-emacs-devel@m.gmane.org; Fri, 28 Jun 2013 16:41:26 +0200 Original-Received: from localhost ([::1]:58907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsZra-0007yV-Ar for ged-emacs-devel@m.gmane.org; Fri, 28 Jun 2013 10:41:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsZrP-0007ke-J9 for emacs-devel@gnu.org; Fri, 28 Jun 2013 10:41:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsZrL-0001z3-Vk for emacs-devel@gnu.org; Fri, 28 Jun 2013 10:41:15 -0400 Original-Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:62473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsZrL-0001xo-PK for emacs-devel@gnu.org; Fri, 28 Jun 2013 10:41:11 -0400 Original-Received: by mail-ea0-f169.google.com with SMTP id h15so1108250eak.28 for ; Fri, 28 Jun 2013 07:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references; bh=h7cj9F/8Bnu97bIpodGuthlxtSF3rnVRWfAyGZsKvJs=; b=H2caRt6+1szcUzoGhvYktoplAipRxUsgWupilu752Tsh5hUxBjmyhAE5XGQZja0v01 Ixsgs+EO3jr7ZUQmsK8iJJZuOZ4MoB8AyUTzXWf89w2NCTx7wtKuSUCLvuhOEZixj/6v V9ffb0+bbKLQwqwQcMiMIKw+mqp3d7SeoplXL3AX5kMrLwT9ylMche+4uXbP4JgOf+p/ KxNy5PK9+WMxr/yYHdrx141oD6GG7QCeaVCRWF0FGzicblLe4/bHIuqy7JViBiQ6mkx3 WSFWGC8w1JppHJkNMPYS7a2H7fCPeDKswJZNp/+DSb4dX0u4rzmHHZemsKo0g8eB8w2Q fTRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=h7cj9F/8Bnu97bIpodGuthlxtSF3rnVRWfAyGZsKvJs=; b=VhtDbmf4GRmZFapxCJ6ZbphM3yEiadZmNNlGms6aAgCuzN8lG/MxfF78AdFGfFSyoo ufthpuw+ubsguEYSfE0ANGFLarevoo3W23UMcfiY4qrfkIvuusLWyn+7rWtb4+dQQ1at hSO31KYIXr1UMEFVlqQD7FGVg6YEGOdFHNt4dOgYV4HQKzXKK6Vl5+Xeq1yNDaZ0QmUL AnAgc+R2czvWtXcXt6ybJ5dFkrJGb2ApkbaDevaelRnZgvSZ4tlMY5QcqnrX5zkQ7fEg JzQ0y48V3xenSTvLPtO4T+32o7DHWSagY0oNHatmyBscTmHHJmbojRt3IqEKTQdm+Lv1 VVMQ== X-Received: by 10.15.108.8 with SMTP id cc8mr14012923eeb.65.1372430470998; Fri, 28 Jun 2013 07:41:10 -0700 (PDT) Original-Received: from mpn-glaptop.corp.google.com ([2620:0:105f:301:3899:bd8c:7f4a:bec8]) by mx.google.com with ESMTPSA id i2sm10938994eeu.4.2013.06.28.07.41.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Jun 2013 07:41:10 -0700 (PDT) X-Mailer: git-send-email 1.8.3.1 In-Reply-To: In-Reply-To: Original-References: X-Gm-Message-State: ALoCoQm7oGMyE7WBDCfKJLgx6Gck4w5XsG2Aglhou3rVxnAUgPHdy4DsW3yq7wypXtDgjZFbCCrElhyJhBMYFf+H0CbVKRJoTUbFIS6eQPu3Vy9QG5XX96al5kCHK4WjUFaesjq10h2CN/mLS8dF05u85L+AgTKIlHUlhB3EGLkSPcIiobSsgiMzYsvIeSrq91N7N1CEv0yO X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::229 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:161217 Archived-At: From: Michal Nazarewicz 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 + * files.el (find-file-noselect): Simplify conditional expression. + +2013-06-28 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