aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-10-02 21:42:42 +0000
committerRichard M. Stallman1996-10-02 21:42:42 +0000
commit52fb15fae2bfa077abfc0e10547681f65936fe86 (patch)
tree411e3becc8d3938e8decd0f35bf75cc0a2f35316
parent8fd2940861d26b0cbe8b2d76c207ae6596bffd92 (diff)
downloademacs-52fb15fae2bfa077abfc0e10547681f65936fe86.tar.gz
emacs-52fb15fae2bfa077abfc0e10547681f65936fe86.zip
Delete several \n\'s.
(profile-fix-fun): Delete an if whose test is never true. Handle doc strings that are also the function value.
-rw-r--r--lisp/emacs-lisp/profile.el66
1 files changed, 38 insertions, 28 deletions
diff --git a/lisp/emacs-lisp/profile.el b/lisp/emacs-lisp/profile.el
index 224e5527602..d8f8b5f86fa 100644
--- a/lisp/emacs-lisp/profile.el
+++ b/lisp/emacs-lisp/profile.el
@@ -85,7 +85,7 @@
85(defvar profile-time-list nil 85(defvar profile-time-list nil
86 "List of cumulative calls and time for each profiled function.") 86 "List of cumulative calls and time for each profiled function.")
87(defvar profile-init-list nil 87(defvar profile-init-list nil
88 "List of entry time for each function. \n\ 88 "List of entry time for each function.
89Both how many times invoked and real time of start.") 89Both how many times invoked and real time of start.")
90(defvar profile-max-fun-name 0 "Max length of name of any function profiled.") 90(defvar profile-max-fun-name 0 "Max length of name of any function profiled.")
91(defvar profile-temp-result- nil "Should NOT be used anywhere else.") 91(defvar profile-temp-result- nil "Should NOT be used anywhere else.")
@@ -97,7 +97,7 @@ Both how many times invoked and real time of start.")
97;;; 97;;;
98 98
99(defun profile-functions (&optional flist) 99(defun profile-functions (&optional flist)
100 "Profile all the functions listed in `profile-functions-list'.\n\ 100 "Profile all the functions listed in `profile-functions-list'.
101With argument FLIST, use the list FLIST instead." 101With argument FLIST, use the list FLIST instead."
102 (interactive "P") 102 (interactive "P")
103 (if (null flist) (setq flist profile-functions-list)) 103 (if (null flist) (setq flist profile-functions-list))
@@ -253,37 +253,47 @@ With argument FLIST, use the list FLIST instead."
253 (fset fun (profile-fix-fun fun def)))) 253 (fset fun (profile-fix-fun fun def))))
254 254
255(defun profile-fix-fun (fun def) 255(defun profile-fix-fun (fun def)
256 "Take function FUN and return it fixed for profiling.\n\ 256 "Take function FUN and return it fixed for profiling.
257DEF is (symbol-function FUN)." 257DEF is (symbol-function FUN)."
258 (let (prefix first second third (count 2) inter suffix) 258 (let (prefix first second third (count 2) inter suffix)
259 (if (< (length def) 3) nil ; nothing to see 259 (if (< (length def) 3)
260 nil ; nothing to see
260 (setq first (car def) second (car (cdr def)) 261 (setq first (car def) second (car (cdr def))
261 third (car (nthcdr 2 def))) 262 third (car (nthcdr 2 def)))
262 (setq prefix (list first second)) 263 (setq prefix (list first second))
263 (if (and (stringp third) (< (length def) 3)) nil ; nothing to see 264 ;; Skip the doc string, if there is a string
264 (if (not (stringp third)) (setq inter third) 265 ;; which serves only as a doc string,
265 (setq count 3 ; suffix to start after doc string 266 ;; and put it in PREFIX.
266 prefix (nconc prefix (list third)) 267 (if (or (not (stringp third)) (not (nthcdr 3 def)))
267 inter (car (nthcdr 3 def))) ; fourth sexp 268 ;; Either no doc string, or it is also the function value.
268 ) 269 (setq inter third)
269 (if (not (and (listp inter) 270 ;; Skip the doc string,
270 (eq (car inter) 'interactive))) nil 271 (setq count 3
271 (setq prefix (nconc prefix (list inter))) 272 prefix (nconc prefix (list third))
272 (setq count (1+ count))) ; skip this sexp for suffix 273 inter (car (nthcdr 3 def))))
273 (setq suffix (nthcdr count def)) 274 ;; Check for an interactive spec.
274 (if (equal (car suffix) '(profile-get-time)) nil;; already set 275 ;; If found, put it inu PREFIX and skip it.
275 ;; prepare new function 276 (if (not (and (listp inter)
276 (nconc prefix 277 (eq (car inter) 'interactive)))
277 (list '(profile-get-time)) ; read time 278 nil
278 (list (list 'profile-start-function 279 (setq prefix (nconc prefix (list inter)))
279 (list 'quote fun))) 280 (setq count (1+ count))) ; skip this sexp for suffix
280 (list (list 'setq 'profile-temp-result- 281 ;; Set SUFFIX to the function body forms.
281 (nconc (list 'progn) suffix))) 282 (setq suffix (nthcdr count def))
282 (list '(profile-get-time)) ; read time 283 (if (equal (car suffix) '(profile-get-time))
283 (list (list 'profile-update-function 284 nil
284 (list 'quote fun))) 285 ;; Prepare new function definition.
285 (list 'profile-temp-result-) 286 (nconc prefix
286 )))))) 287 (list '(profile-get-time)) ; read time
288 (list (list 'profile-start-function
289 (list 'quote fun)))
290 (list (list 'setq 'profile-temp-result-
291 (nconc (list 'progn) suffix)))
292 (list '(profile-get-time)) ; read time
293 (list (list 'profile-update-function
294 (list 'quote fun)))
295 (list 'profile-temp-result-)
296 )))))
287 297
288(defun profile-restore-fun (fun) 298(defun profile-restore-fun (fun)
289 "Restore profiled function FUN to its original state." 299 "Restore profiled function FUN to its original state."