Function: python--do-isort

python--do-isort is a byte-compiled function defined in python.el.gz.

Signature

(python--do-isort &rest ARGS)

Documentation

Edit the current buffer using isort called with ARGS.

Return non-nil if the buffer was actually modified.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python--do-isort (&rest args)
  "Edit the current buffer using isort called with ARGS.
Return non-nil if the buffer was actually modified."
  (let ((buffer (current-buffer)))
    (with-temp-buffer
      (let ((temp (current-buffer)))
        (with-current-buffer buffer
          (let ((status (apply #'call-process-region
                               (point-min) (point-max)
                               python-interpreter
                               nil (list temp nil) nil
                               (append
                                 (split-string-shell-command
                                  python-interpreter-args)
                                 '("-m" "isort" "-")
                                 args)))
                (tick (buffer-chars-modified-tick)))
            (unless (eq 0 status)
              (error "%s exited with status %s (maybe isort is missing?)"
                     python-interpreter status))
            (replace-buffer-contents temp)
            (not (eq tick (buffer-chars-modified-tick)))))))))