Changeset 7060 for lang/elisp

Show
Ignore:
Timestamp:
02/23/08 12:14:15 (9 months ago)
Author:
taiyoh
Message:

lang/elisp/set-perl5lib: ifとかletが連続してキモかったのでリファクタリング

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/elisp/set-perl5lib/set-perl5lib.el

    r7047 r7060  
    3636 
    3737(defun perllib-check-path (lst lib-path) 
    38   (let ((dir (car lst)) (lst (cdr lst))) 
    39     (let ((set-lib-path (concat lib-path "/lib"))) 
    40       (if lst 
    41           (if (string= dir "lib") 
    42               set-lib-path 
    43             (if (and (string= dir "t") 
    44                      (file-readable-p set-lib-path)) 
    45                 set-lib-path 
    46               (perllib-check-path lst (concat lib-path "/" dir)))))))) 
     38  (let ((dir (car lst)) 
     39        (set-lib-path (concat lib-path "/lib"))) 
     40    (if (setf stock-lst (cdr lst)) 
     41        (cond ((string= dir "lib") set-lib-path) 
     42              ((and (string= dir "t") 
     43                    (file-readable-p set-lib-path)) set-lib-path) 
     44              (t (perllib-check-path stock-lst (concat lib-path "/" dir))))))) 
    4745 
    4846(defun set-perl5lib () 
    4947  "set path into PERL5LIB if its file path includes 'lib' directory" 
    5048  (interactive) 
    51   (setf path-list (cdr (split-string buffer-file-name "/")) 
    52         lib-path (perllib-check-path path-list "")) 
    53   (if lib-path 
    54       (let () 
    55         (setenv "PERL5LIB" lib-path) 
    56         (message (concat "PERL5LIB=" lib-path))))) 
     49  (let ((path-list (cdr (split-string buffer-file-name "/")))) 
     50    (if (setf lib-path (perllib-check-path path-list "")) 
     51        (let () 
     52          (setenv "PERL5LIB" lib-path) 
     53          (message (concat "PERL5LIB=" lib-path)))))) 
    5754 
    5855(provide 'set-perl5lib)