[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117430: * lisp/progmodes/hideif.el: Use lexical-bin
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r117430: * lisp/progmodes/hideif.el: Use lexical-binding. Fix up cl-lib usage. |
Date: |
Sat, 28 Jun 2014 01:52:44 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117430
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2014-06-27 21:52:38 -0400
message:
* lisp/progmodes/hideif.el: Use lexical-binding. Fix up cl-lib usage.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/hideif.el hideif.el-20091113204419-o5vbwnq5f7feedwu-39
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-06-28 01:35:48 +0000
+++ b/lisp/ChangeLog 2014-06-28 01:52:38 +0000
@@ -1,3 +1,7 @@
+2014-06-28 Stefan Monnier <address@hidden>
+
+ * progmodes/hideif.el: Use lexical-binding. Fix up cl-lib usage.
+
2014-06-28 K. Handa <address@hidden>
Fix Bug#17739.
=== modified file 'lisp/progmodes/hideif.el'
--- a/lisp/progmodes/hideif.el 2014-06-27 08:25:21 +0000
+++ b/lisp/progmodes/hideif.el 2014-06-28 01:52:38 +0000
@@ -1,4 +1,4 @@
-;;; hideif.el --- hides selected code within ifdef
+;;; hideif.el --- hides selected code within ifdef -*- lexical-binding:t -*-
;; Copyright (C) 1988, 1994, 2001-2014 Free Software Foundation, Inc.
@@ -550,8 +550,8 @@
(setq tok (cadr tokens))
(if (eq (car tokens) 'hif-lparen)
(if (and (hif-if-valid-identifier-p tok)
- (eq (caddr tokens) 'hif-rparen))
- (setq tokens (cdddr tokens))
+ (eq (cl-caddr tokens) 'hif-rparen))
+ (setq tokens (cl-cdddr tokens))
(error "#define followed by non-identifier: %S" tok))
(setq tok (car tokens)
tokens (cdr tokens))
@@ -607,9 +607,8 @@
;; for hif-macro-supply-arguments
(let* ((hif-token-list (cdr remains))
(hif-token nil)
- (parmlist (mapcar 'hif-expand-token-list
- (hif-get-argument-list
- tok)))
+ (parmlist (mapcar #'hif-expand-token-list
+ (hif-get-argument-list)))
(result
(hif-expand-token-list
(hif-macro-supply-arguments tok parmlist)
@@ -618,10 +617,10 @@
result))
;; Argument list is nil, direct expansion
(setq rep (hif-expand-token-list
- (caddr rep) ; Macro's token list
+ (cl-caddr rep) ; Macro's token list
tok expand_list))
;; Replace all remaining references immediately
- (setq remains (substitute tok rep remains))
+ (setq remains (cl-substitute tok rep remains))
rep)
;; Lookup tok returns an atom
rep))
@@ -824,7 +823,7 @@
(hif-place-macro-invocation ident)
`(hif-lookup (quote ,ident)))))))
-(defun hif-get-argument-list (ident)
+(defun hif-get-argument-list ()
(let ((nest 0)
(parmlist nil) ; A "token" list of parameters, will later be parsed
(parm nil))
@@ -849,7 +848,7 @@
(nreverse parmlist)))
(defun hif-place-macro-invocation (ident)
- (let ((parmlist (hif-get-argument-list ident)))
+ (let ((parmlist (hif-get-argument-list)))
`(hif-invoke (quote ,ident) (quote ,parmlist))))
(defun hif-string-concatenation ()
@@ -861,7 +860,7 @@
(substring hif-token 1)))) ; remove leading '"'
result))
-(defun hif-define-macro (parmlist token-body)
+(defun hif-define-macro (_parmlist _token-body)
"A marker for defined macro with arguments.
This macro cannot be evaluated alone without parameters inputed."
;;TODO: input arguments at run time, use minibuffer to query all arguments
@@ -1002,8 +1001,8 @@
result)))
(defun hif-delimit (lis atom)
- (nconc (mapcan (lambda (l) (list l atom))
- (butlast lis))
+ (nconc (cl-mapcan (lambda (l) (list l atom))
+ (butlast lis))
(last lis)))
;; Perform token replacement:
@@ -1018,7 +1017,6 @@
(macro-body (and macro (cadr macro)))
actual-count
formal-count
- actual
formal
etc)
@@ -1055,10 +1053,10 @@
;; Unlike `subst', `substitute' replace only the top level
;; instead of the whole tree; more importantly, it's not
;; destructive.
- (substitute (if (and etc (null formal-parms))
- (hif-delimit actual-parms 'hif-comma)
- (car actual-parms))
- formal macro-body))
+ (cl-substitute (if (and etc (null formal-parms))
+ (hif-delimit actual-parms 'hif-comma)
+ (car actual-parms))
+ formal macro-body))
(setq actual-parms (cdr actual-parms)))
;; Replacement completed, flatten the whole token list
@@ -1462,7 +1460,6 @@
(let* ((defining (string= "define" (match-string 2)))
(name (and (re-search-forward hif-macroref-regexp max t)
(match-string 1)))
- (parsed nil)
(parmlist (and (match-string 3) ; First arg id found
(hif-parse-macro-arglist (match-string 2)))))
(if defining
@@ -1534,15 +1531,15 @@
(save-excursion
(let ((case-fold-search nil)
min max)
- (goto-char (point-min))
+ (goto-char (point-min))
(setf min (point))
- (loop do
- (setf max (hif-find-any-ifX))
- (hif-add-new-defines min max)
- (if max
- (hif-possibly-hide))
- (setf min (point))
- while max))))
+ (cl-loop do
+ (setf max (hif-find-any-ifX))
+ (hif-add-new-defines min max)
+ (if max
+ (hif-possibly-hide))
+ (setf min (point))
+ while max))))
;;===%%SF%% hide-ifdef-hiding (End) ===
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117430: * lisp/progmodes/hideif.el: Use lexical-binding. Fix up cl-lib usage.,
Stefan Monnier <=