named @var{indirect-name} from a buffer @var{base-buffer}, prompting for
both using the minibuffer.
+@vindex clone-indirect-buffer-hook
+ The functions that create indirect buffers run the hook
+@code{clone-indirect-buffer-hook} after creating the indirect buffer.
+When this hook runs, the newly created indirect buffer is the current
+buffer.
+
+ Note: When a modification is made to the text of a buffer, the
+ modification hooks are run only in the base buffer, because most of
+ the functions on those hooks are not prepared to work correctly in
+ indirect buffers. So if you need a modification hook function in an
+ indirect buffer, you need to manually add that function to the hook
+ @emph{in the base buffer} and then make the function operate in the
+ desired indirect buffer.
+
@node Buffer Convenience
@section Convenience Features and Customization of Buffer Handling
((symbolp place) `(default-value ',place))
(t place))))
+(defun nadvice--make-docstring (sym)
+ (let* ((main (documentation (symbol-function sym) 'raw))
+ (ud (help-split-fundoc main 'pcase))
+ (doc (or (cdr ud) main))
+ (col1width (apply #'max (mapcar (lambda (x)
+ (string-width (symbol-name (car x))))
+ advice--how-alist)))
+ (table (mapconcat (lambda (x)
+ (format (format " %%-%ds %%s" col1width)
+ (car x) (nth 2 x)))
+ advice--how-alist "\n"))
+ (table (if global-prettify-symbols-mode
+ (replace-regexp-in-string "(lambda\\>" "(λ" table t t)
+ table))
+ (combined-doc
+ (if (not (string-match "<<>>" doc))
+ doc
+ (replace-match table t t doc))))
+ (if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc)))
+
+(put 'add-function 'function-documentation
+ '(nadvice--make-docstring 'add-function))
+
;;;###autoload
-(defmacro add-function (where place function &optional props)
+(defmacro add-function (how place function &optional props)
;; TODO:
- ;; - maybe let `where' specify some kind of predicate and use it
+ ;; - maybe let `how' specify some kind of predicate and use it
- ;; to implement things like mode-local or eieio-defmethod.
+ ;; to implement things like mode-local or cl-defmethod.
;; Of course, that only makes sense if the predicates of all advices can
;; be combined and made more efficient.
;; :before is like a normal add-hook on a normal hook.
(declare
;;(indent 2)
(debug (form [&or symbolp ("local" form) ("var" sexp) gv-place]
-- form &optional form)))
- `(advice--add-function ,where (gv-ref ,(advice--normalize-place place))
++ form &optional form)))
+ `(advice--add-function ,how (gv-ref ,(advice--normalize-place place))
,function ,props))
(declare-function comp-subr-trampoline-install "comp")
;; We have the image data in SOURCE.
(progn
(insert source)
- (apply #'call-process-region (point-min) (point-max)
- (car command) t t nil
- (append
- (cdr command)
- (list (format "%s:-"
- (image-converter--mime-type
- image-format))
+ (let ((coding-system-for-write 'no-conversion))
+ (apply #'call-process-region (point-min) (point-max)
+ (car command) t t nil
+ (append
+ (cdr command)
+ (list (format "%s:-"
+ (image-converter--mime-type
+ image-format))
- "png:-")))))
+ (concat image-convert-to-format
- ":-")))))
++ ":-"))))))
;; SOURCE is a file name.
(apply #'call-process (car command)
nil t nil
(unless (zerop (if image-format
(progn
(insert source)
- (apply #'call-process-region
- (point-min) (point-max) (car command)
- t '(t nil) nil
- (append
- (cdr command)
- (list "-i" "-"
- "-c:v" image-convert-to-format
- "-f" "image2pipe" "-"))))
+ (let ((coding-system-for-write 'no-conversion))
+ (apply #'call-process-region
+ (point-min) (point-max) (car command)
+ t '(t nil) nil
+ (append
+ (cdr command)
+ (list "-i" "-"
- "-c:v" "png"
++ "-c:v" image-convert-to-format
+ "-f" "image2pipe" "-")))))
(apply #'call-process
(car command)
nil '(t nil) nil