emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master b1da26d 10/11: Stefans fixes


From: Artur Malabarba
Subject: [elpa] master b1da26d 10/11: Stefans fixes
Date: Thu, 18 Jun 2015 17:30:27 +0000

branch: master
commit b1da26d96cbe8308d0988f6b92737819f98f20fd
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Stefans fixes
---
 names.el |  115 +++++++++++++++++++++++++++++++------------------------------
 1 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/names.el b/names.el
index 535050f..b5f403e 100644
--- a/names.el
+++ b/names.el
@@ -1,11 +1,11 @@
-;;; names.el --- Namespaces for emacs-lisp. Avoid name clobbering without 
hiding symbols.
+;;; names.el --- Namespaces for emacs-lisp. Avoid name clobbering without 
hiding symbols.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 ;; Maintainer: Artur Malabarba <address@hidden>
 ;; URL: http://github.com/Bruce-Connor/names
-;; Version: 20150617.0
+;; Version: 20150618.0
 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
 ;; Keywords: extensions lisp
 ;; Prefix: names
@@ -44,10 +44,12 @@
 ;; If `C-x' is not a prefix.
 (unless (consp (key-binding "\C-x"))
   ;; Disable the `C-xC-a' binds.
+  (defvar edebug-inhibit-emacs-lisp-mode-bindings)
   (setq edebug-inhibit-emacs-lisp-mode-bindings t)
   ;; And the `C-xX' binds.
+  (defvar global-edebug-prefix)
   (when (or (null (boundp 'global-edebug-prefix))
-            (eq 24 (elt global-edebug-prefix 0)))
+            (eq ?\C-x (elt global-edebug-prefix 0)))
     (setq global-edebug-prefix "")))
 (require 'edebug)
 (require 'bytecomp)
@@ -55,44 +57,46 @@
 
 ;;; Support
 (declare-function names--autoload-do-load "names" 2)
-(if (fboundp 'function-get)
-    (defalias 'names--function-get #'function-get)
-  (defun names--function-get (f prop &rest _)
-    "Return the value of property PROP of function F.
+(defalias 'names--function-get
+  (if (fboundp 'function-get) #'function-get
+
+    (defun names--autoload-do-load (def name)
+      "Load autoloaded definition DEF from function named NAME."
+      (unless (load (cadr def) 'noerror)
+        (error "Macro `%s' is autoloaded, but its file (%s) couldn't be loaded"
+          name (cadr def)))
+      (symbol-function name))
+
+    (lambda (f prop &rest _)
+      "Return the value of property PROP of function F.
 If F is an autoloaded macro, try to autoload it in the hope that
 it will set PROP."
-    (let ((val nil))
-      (while (and (symbolp f)
-                  (null (setq val (get f prop)))
-                  (fboundp f))
-        (let ((fundef (symbol-function f)))
-          (if (and (names--autoloadp fundef)
-                   (not (equal fundef (names--autoload-do-load fundef f))))
-              nil ;Re-try `get' on the same `f'.
-            (setq f fundef))))
-      val))
-  (defun names--autoload-do-load (def name)
-    "Load autoloaded definition DEF from function named NAME."
-    (unless (load (cadr def) 'noerror)
-      (error "Macro `%s' is autoloaded, but its file (%s) couldn't be loaded"
-             name (cadr def)))
-    (symbol-function name)))
-
-(if (fboundp 'macrop)
-    (defalias 'names--compat-macrop #'macrop)
-  (defun names--compat-macrop (object)
-    "Non-nil if and only if OBJECT is a macro."
-    (let ((def (or (ignore-errors (indirect-function object t))
-                   (ignore-errors (indirect-function object)))))
-      (when (consp def)
-        (or (eq 'macro (car def))
-            (and (names--autoloadp def) (memq (nth 4 def) '(macro t))))))))
-
-(if (fboundp 'autoloadp)
-    (defalias 'names--autoloadp #'autoloadp)
-  (defsubst names--autoloadp (object)
-    "Non-nil if OBJECT is an autoload."
-    (eq 'autoload (car-safe object))))
+      (let ((val nil))
+        (while (and (symbolp f)
+                    (null (setq val (get f prop)))
+                    (fboundp f))
+          (let ((fundef (symbol-function f)))
+            (if (and (names--autoloadp fundef)
+                     (not (equal fundef (names--autoload-do-load fundef f))))
+                nil                     ;Re-try `get' on the same `f'.
+              (setq f fundef))))
+        val))))
+
+(defalias 'names--compat-macrop
+  (if (fboundp 'macrop) #'macrop
+    (lambda (object)
+      "Non-nil if and only if OBJECT is a macro."
+      (let ((def (or (ignore-errors (indirect-function object t))
+                     (ignore-errors (indirect-function object)))))
+        (when (consp def)
+          (or (eq 'macro (car def))
+              (and (names--autoloadp def) (memq (nth 4 def) '(macro t)))))))))
+
+(defalias 'names--autoloadp
+  (if (fboundp 'autoloadp) #'autoloadp
+    (lambda (object)
+      "Non-nil if OBJECT is an autoload."
+      (eq 'autoload (car-safe object)))))
 
 (unless (get-edebug-spec 'cl-defun)
   (def-edebug-spec cl-defun defun*))
@@ -121,7 +125,7 @@ it will set PROP."
 
 ;;; ---------------------------------------------------------------
 ;;; Variables
-(defconst names-version "20150617.0" "Version of the names.el package.")
+(defconst names-version "20150618.0" "Version of the names.el package.")
 
 (defvar names--name nil
   "Name of the current namespace inside the `define-namespace' macro.")
@@ -314,9 +318,9 @@ behaviour.")
   `(when (boundp ',var)
      (remove
       nil
-      (mapcar (lambda (x) (when (funcall (or ,pred 'identity) (or (car-safe x) 
x))
-                (or (car-safe x) x)))
-          ,var))))
+      (mapcar (lambda (x) (when (funcall (or ,pred #'identity) (or (car-safe 
x) x))
+                            (or (car-safe x) x)))
+              ,var))))
 
 (defmacro names--next-keyword (body)
   "If car of BODY is a known keyword, `pop' it (and its arguments) from body.
@@ -328,7 +332,7 @@ Returns a list (KEYWORD . ARGUMENTLIST)."
           (keywordp kar)
           (setq n (assoc kar names--keyword-list))
           (setq n (cadr n))
-          (dotimes (it (1+ n) out)
+          (dotimes (_ (1+ n) out)
             (push (pop ,body) out))
           (nreverse out))))
 
@@ -698,14 +702,14 @@ Use the `names--inside-make-autoload' variable to 
indicate to
 (defun names--message (f &rest rest)
   "If :verbose is on, pass F and REST to `message'."
   (when (names--keyword :verbose)
-    (apply 'message (concat "[names] " f) rest)))
+    (apply #'message (concat "[names] " f) rest)))
 
 (defun names--warn (f &rest rest)
   "Pass F and REST to `message', unless byte-compiling or non-interactive."
   (unless (and (null (names--keyword :verbose))
                (and (boundp 'byte-compile-function-environment)
                     byte-compile-function-environment))
-    (apply 'message (concat "[names] " f) rest)))
+    (apply #'message (concat "[names] " f) rest)))
 
 (defun names--error-if-using-vars ()
   "Remind the developer that variables are not customizable."
@@ -720,7 +724,7 @@ Use the `names--inside-make-autoload' variable to indicate 
to
   "Return a concatenated un-namespaced version of LISTS.
 Symbols in LISTS that aren't namespaced are removed, symbols that
 are namespaced become un-namespaced."
-  (delq nil (mapcar 'names--remove-namespace (apply 'append lists))))
+  (delq nil (mapcar 'names--remove-namespace (apply #'append lists))))
 
 (defun names--remove-namespace (symbol)
   "Return SYMBOL with namespace removed, or nil if it wasn't namespaced."
@@ -971,11 +975,10 @@ the keyword arguments, if any."
 ;; lines of the functions defined below. It will be automatically used
 ;; whenever that form is found.
 
-;;; Defun, defmacro, and defsubst macros are pretty predictable.
+;; Defun, defmacro, and defsubst macros are pretty predictable.
 (defun names--convert-defmacro (form)
   "Special treatment for `defmacro' FORM."
-  (let* ((names--name-already-prefixed t)
-         (name (cadr form))
+  (let* ((name (cadr form))
          (spaced-name (names--prepend name))
          decl)
     (add-to-list 'names--macro name)
@@ -1139,9 +1142,9 @@ quoted symbols)."
        (names--handle-symbol-as-function (pop copy))
        (names--handle-symbol-as-function (pop copy)))
       (mapcar #'names-convert-form copy)))))
-(defalias #'names--convert-define-global-minor-mode
+(defalias 'names--convert-define-global-minor-mode
   #'names--convert-define-globalized-minor-mode)
-(defalias #'names--convert-easy-mmode-define-global-mode
+(defalias 'names--convert-easy-mmode-define-global-mode
   #'names--convert-define-globalized-minor-mode)
 
 (defun names--convert-quote (form)
@@ -1153,8 +1156,7 @@ logically namespaced and is never parsed for namespacing
 When FORM is (function form), a symbol is namespaced as a
 function name, a list is namespaced as a lambda form."
   (let ((kadr (cadr form))
-        (this-name (car form))
-        func)
+        (this-name (car form)))
     (if (and (eq this-name 'function)
              (listp kadr))
         (list this-name (names-convert-form kadr))
@@ -1219,8 +1221,7 @@ Return (macro . (names-convert-form (cdr FORM)))."
   (names--warn "Found a `closure'! You should use `lambda's instead")
   (let ((names--local-vars
          (append (names--vars-from-arglist (cadr form))
-                 names--local-vars))
-        (forms (cdr (cdr form))))
+                 names--local-vars)))
     (cons
      (car form)
      (names--convert-lambda (cdr form)))))



reply via email to

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