.emacs-my
changeset 1631 f6eae5ebf7d9
parent 1630 8e99c0b3b772
child 1632 9189d278b075
equal deleted inserted replaced
1630:8e99c0b3b772 1631:f6eae5ebf7d9
   179     (while li
   179     (while li
   180       (setq x2 (funcall f x2 (pop li)))
   180       (setq x2 (funcall f x2 (pop li)))
   181       )
   181       )
   182     x2
   182     x2
   183     ) )
   183     ) )
       
   184 
       
   185 (defun my-assoc-push (key value alist)
       
   186   "Add association if `key' is not in `alist' and replace all
       
   187 accociation with single, if there is `key'."
       
   188   (when (not (symbolp alist)) (error "alist is not a symbol."))
       
   189   (set alist
       
   190        (cons (cons key value)
       
   191              (cl-remove key (symbol-value alist) :key #'car :test #'equal))))
   184 
   192 
   185 (unless (fboundp 'ignore-errors)
   193 (unless (fboundp 'ignore-errors)
   186   (defmacro ignore-errors (&rest body)
   194   (defmacro ignore-errors (&rest body)
   187     "Execute BODY; if an error occurs, return nil.
   195     "Execute BODY; if an error occurs, return nil.
   188 Otherwise, return result of last form in BODY."
   196 Otherwise, return result of last form in BODY."