tail))
(t (cons 'list heads)))))
+\f
+;; Give `,' and `,@' documentation strings which can be examined by C-h f.
+(put '\, 'function-documentation
+ "See `\\=`' (also `pcase') for the usage of `,'.")
+(put '\, 'reader-construct t)
+
+(put '\,@ 'function-documentation
+ "See `\\=`' for the usage of `,@'.")
+(put '\,@ 'reader-construct t)
+
;;; backquote.el ends here
(if fn
(format "Describe function (default %s): " fn)
"Describe function: ")
- #'help--symbol-completion-table #'fboundp t nil nil
+ #'help--symbol-completion-table
+ (lambda (f) (or (fboundp f) (get f 'function-documentation)))
+ t nil nil
(and fn (symbol-name fn)))))
(unless (equal val "")
(setq fn (intern val)))
(unless (and fn (symbolp fn))
(user-error "You didn't specify a function symbol"))
- (unless (fboundp fn)
+ (unless (or (fboundp fn) (get fn 'function-documentation))
(user-error "Symbol's function definition is void: %s" fn))
(list fn)))
(save-excursion
(with-help-window (help-buffer)
- (prin1 function)
+ (if (get function 'reader-construct)
+ (princ function)
+ (prin1 function))
;; Use " is " instead of a colon so that
;; it is easier to get out the function name using forward-sexp.
(princ " is ")
(let ((fill-begin (point))
(high-usage (car high))
(high-doc (cdr high)))
- (insert high-usage "\n")
+ (unless (get function 'reader-construct)
+ (insert high-usage "\n"))
(fill-region fill-begin (point))
high-doc)))))
(or (and advised
(advice--cd*r (advice--symbol-function function)))
function))
- ;; Get the real definition.
+ ;; Get the real definition, if any.
(def (if (symbolp real-function)
- (or (symbol-function real-function)
- (signal 'void-function (list real-function)))
+ (cond ((symbol-function real-function))
+ ((get real-function 'function-documentation)
+ nil)
+ (t (signal 'void-function (list real-function))))
real-function))
- (aliased (or (symbolp def)
- ;; Advised & aliased function.
- (and advised (symbolp real-function)
- (not (eq 'autoload (car-safe def))))
- (and (subrp def)
- (not (string= (subr-name def)
- (symbol-name function))))))
+ (aliased (and def
+ (or (symbolp def)
+ ;; Advised & aliased function.
+ (and advised (symbolp real-function)
+ (not (eq 'autoload (car-safe def))))
+ (and (subrp def)
+ (not (string= (subr-name def)
+ (symbol-name function)))))))
(real-def (cond
((and aliased (not (subrp def)))
(let ((f real-function))
;; Print what kind of function-like object FUNCTION is.
(princ (cond ((or (stringp def) (vectorp def))
"a keyboard macro")
+ ((get function 'reader-construct)
+ "a reader construct")
;; Aliases are Lisp functions, so we need to check
;; aliases before functions.
(aliased