.emacs-my
changeset 716 a3f42d9dd281
parent 715 973cc8f1023a
child 717 b958f182d0d4
equal deleted inserted replaced
715:973cc8f1023a 716:a3f42d9dd281
    63                (if r
    63                (if r
    64                    (nconc r (cons item nil))
    64                    (nconc r (cons item nil))
    65                  (setq r (cons item nil)))))
    65                  (setq r (cons item nil)))))
    66            ,list)
    66            ,list)
    67      r))
    67      r))
       
    68 
       
    69 (defun my-fold (f x list)
       
    70   "Recursively applies (F i j) to LIST starting with X.
       
    71 For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)."
       
    72   (let ((li list) (x2 x))
       
    73     (while li
       
    74       (setq x2 (funcall f x2 (pop li)))
       
    75       )
       
    76     x2
       
    77     ) )
    68 
    78 
    69 ;;; ----------------------------------------------------------------
    79 ;;; ----------------------------------------------------------------
    70 (message "mode groups")
    80 (message "mode groups")
    71 
    81 
    72 (defmacro my-defun-rename-symb-tree (name doc func)
    82 (defmacro my-defun-rename-symb-tree (name doc func)
   758 ;;; ----------------------------------------------------------------
   768 ;;; ----------------------------------------------------------------
   759 (message "music")
   769 (message "music")
   760 (setq gnus-audio-au-player "winamp.exe"
   770 (setq gnus-audio-au-player "winamp.exe"
   761       gnus-audio-directory "D:\\music"
   771       gnus-audio-directory "D:\\music"
   762       gnus-audio-wav-player "winamp.exe")
   772       gnus-audio-wav-player "winamp.exe")
       
   773 
       
   774 ;;; ----------------------------------------------------------------
       
   775 (message "url")
       
   776 
       
   777 ;; http://tools.ietf.org/html/rfc3986
       
   778 ;; http://en.wikipedia.org/wiki/Percent-encoding
       
   779 (defun my-percent-decode (str)
       
   780   (decode-coding-string
       
   781    (let* ( (s (split-string str "%")) )
       
   782      (my-fold
       
   783       'concat
       
   784       (car s)
       
   785       (mapcar
       
   786        (lambda (x)
       
   787          (concat (unibyte-string (string-to-number (substring x 0 2) 16)) (substring x 2)))
       
   788        (cdr s))
       
   789       )) 'utf-8))
   763 
   790 
   764 ;;; ----------------------------------------------------------------
   791 ;;; ----------------------------------------------------------------
   765 (message "browser")
   792 (message "browser")
   766 
   793 
   767 (cond
   794 (cond