;;; Code:
+(provide 'poe)
+
(defmacro defun-maybe (name &rest everything-else)
(or (and (fboundp name)
(not (get name 'defun-maybe)))
)))
(defmacro defun-maybe-cond (name args &optional doc &rest everything-else)
- (unless (stringp doc)
- (setq everything-else (cons doc everything-else)
- doc nil)
- )
+ (or (stringp doc)
+ (setq everything-else (cons doc everything-else)
+ doc nil)
+ )
(or (and (fboundp name)
(not (get name 'defun-maybe)))
- (` (unless (fboundp (quote (, name)))
- (cond (,@ (mapcar (function
- (lambda (case)
- (list (car case)
- (if doc
- (` (defun (, name) (, args)
- (, doc)
- (,@ (cdr case))))
- (` (defun (, name) (, args)
- (,@ (cdr case))))
- ))))
- everything-else)))
- (put (quote (, name)) 'defun-maybe t)
- ))))
+ (` (or (fboundp (quote (, name)))
+ (progn
+ (cond (,@ (mapcar (function
+ (lambda (case)
+ (list (car case)
+ (if doc
+ (` (defun (, name) (, args)
+ (, doc)
+ (,@ (cdr case))))
+ (` (defun (, name) (, args)
+ (,@ (cdr case))))
+ ))))
+ everything-else)))
+ (put (quote (, name)) 'defun-maybe t)
+ )))))
(defsubst subr-fboundp (symbol)
"Return t if SYMBOL's function definition is a built-in function."
(require 'poe-18)
))
-
;;; @ Emacs 19.23 emulation
;;;
(setq list (cdr list)))
))
-(defmacro-maybe make-local-hook (hook))
-
-;; They are not Emacs features
-
+(defun-maybe file-name-sans-extension (filename)
+ "Return FILENAME sans final \"extension\".
+The extension, in a file name, is the part that follows the last `.'."
+ (save-match-data
+ (let ((file (file-name-sans-versions (file-name-nondirectory filename)))
+ directory)
+ (if (string-match "\\.[^.]*\\'" file)
+ (if (setq directory (file-name-directory filename))
+ (expand-file-name (substring file 0 (match-beginning 0))
+ directory)
+ (substring file 0 (match-beginning 0)))
+ filename))))
+
+;; It is not Emacs feature.
(defmacro-maybe add-local-hook (hook function &optional append)
(if (fboundp 'make-local-hook)
(list 'add-hook hook function append t)
(list 'add-hook hook function append)
))
+;; It is not Emacs feature.
(defmacro-maybe remove-local-hook (hook function)
(if (fboundp 'make-local-hook)
(list 'remove-hook hook function t)
(list 'remove-hook hook function)
))
+(defmacro-maybe make-local-hook (hook))
+
;;; @ Emacs 19.30 emulation
;;;
;;; @ end
;;;
-(provide 'poe)
-
;;; poe.el ends here