emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 367f856: * lisp/emacs-lisp/ring.el: Use lexical-bin


From: Simen Heggestøyl
Subject: [Emacs-diffs] master 367f856: * lisp/emacs-lisp/ring.el: Use lexical-binding
Date: Fri, 9 Sep 2016 16:47:41 +0000 (UTC)

branch: master
commit 367f8568bc9e759ebdfb423648891efa0346456b
Author: Simen Heggestøyl <address@hidden>
Commit: Simen Heggestøyl <address@hidden>

    * lisp/emacs-lisp/ring.el: Use lexical-binding
    
    * lisp/emacs-lisp/ring.el (ring-elements): Don't use the RESULT
    argument of `dotimes' when the iteration variable isn't referred by
    it.
    (ring-member): Don't pass nil as the RESULT argument of `dotimes'
    since it's the default.
---
 lisp/emacs-lisp/ring.el            |    9 +++++----
 test/lisp/emacs-lisp/ring-tests.el |    2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index b1b6626..c6684ec 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -1,4 +1,4 @@
-;;; ring.el --- handle rings of items
+;;; ring.el --- handle rings of items   -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1992, 2001-2016 Free Software Foundation, Inc.
 
@@ -160,14 +160,15 @@ will be performed."
        (size (ring-size ring))
        (vect (cddr ring))
        lst)
-    (dotimes (var (cadr ring) lst)
-      (push (aref vect (mod (+ start var) size)) lst))))
+    (dotimes (var (cadr ring))
+      (push (aref vect (mod (+ start var) size)) lst))
+    lst))
 
 (defun ring-member (ring item)
   "Return index of ITEM if on RING, else nil.
 Comparison is done via `equal'.  The index is 0-based."
   (catch 'found
-    (dotimes (ind (ring-length ring) nil)
+    (dotimes (ind (ring-length ring))
       (when (equal item (ring-ref ring ind))
        (throw 'found ind)))))
 
diff --git a/test/lisp/emacs-lisp/ring-tests.el 
b/test/lisp/emacs-lisp/ring-tests.el
index 705bfe5..affde89 100644
--- a/test/lisp/emacs-lisp/ring-tests.el
+++ b/test/lisp/emacs-lisp/ring-tests.el
@@ -5,6 +5,8 @@
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords:
 
+;; This file is part of GNU Emacs.
+
 ;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or



reply via email to

[Prev in Thread] Current Thread [Next in Thread]