sphinx-doc.el
sphinx-doc.el copied to clipboard
Sphinx makes python files not load python-mode
I am using emacs 30.0.50, each time a python file is opened i have to activate manually python-mode multiple times. I can't use sphinx-doc anymore :(
My .emacs.d/init.el
(use-package sphinx-doc
:straight t
:hook (python-mode sphinx-doc)
:config (add-hook 'python-mode-hook (lambda ()
(require 'sphinx-doc)
(sphinx-doc-mode t)))
:after python
)
The error message:
Debugger entered--Lisp error: (search-failed "def")
search-backward-regexp("def")
(if (string= (thing-at-point 'word) "def") (back-to-indentation) (search-backward-regexp sphinx-doc-fun-beg-regex))
sphinx-doc()
run-hooks(change-major-mode-after-body-hook prog-mode-hook python-base-mode-hook python-mode-hook)
apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook python-base-mode-hook python-mode-hook))
run-mode-hooks(python-mode-hook)
python-mode()
set-auto-mode-0(python-mode nil)
set-auto-mode--apply-alist((("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:ld\\)?\\)\\|composer\\.lock\\)\\'\\)" . json-mode) ("^yang\\.settings$" . jsonc-mode) ("\\.md\\'" . markdown-mode) ("\\.js$" . js2-mode) ("\\.envrc\\'" . direnv-envrc-mode) ("\\.[Jj]ust\\(file\\)?\\'" . just-mode) ("/[Jj]ustfile\\'" . just-mode) ("\\.lua\\'" . lua-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("Dockerfile\\'" . dockerfile-mode) ("\\.dockerfile\\'" . dockerfile-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?\\'" . dockerfile-mode) ("/git-rebase-todo\\'" . git-rebase-mode) ("\\.css\\'" . rainbow-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("/Jenkinsfile\\'" . groovy-mode) ("\\.g\\(?:ant\\|roovy\\|radle\\)\\'" . groovy-mode) ("\\.j2\\'" . jinja2-mode) ("\\.jinja2\\'" . jinja2-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'" . ruby-mode) ("\\.re?st\\'" . rst-mode) ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . conf-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ...) nil nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer file.py> "~/file.py" nil nil "~/file.py" (13013303 64513))
find-file-noselect("/home/user/file.py" nil nil nil)
find-file("/home/user/file.py")
(cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate)))
(let ((dir (and (not url-p) (helm-basedir candidate)))) (cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate))))
(if (cdr marked) (if (equal helm-current-prefix-arg '(16)) (mapc 'find-file-noselect marked) (helm-window-show-buffers (mapcar 'find-file-noselect marked))) (let ((dir (and (not url-p) (helm-basedir candidate)))) (cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate)))))
(let ((marked (helm-marked-candidates :with-wildcard t)) (url-p (and helm--url-regexp (string-match helm--url-regexp candidate))) (ffap-newfile-prompt helm-ff-newfile-prompt-p) (find-file-wildcards nil) (helm--reading-passwd-or-string t)) (if (cdr marked) (if (equal helm-current-prefix-arg '(16)) (mapc 'find-file-noselect marked) (helm-window-show-buffers (mapcar 'find-file-noselect marked))) (let ((dir (and (not url-p) (helm-basedir candidate)))) (cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate))))))
helm-find-file-or-marked("/home/user/file.py")
funcall(helm-find-file-or-marked "/home/user/file.py")
(progn (funcall action selection))
(if (and selection action) (progn (funcall action selection)))
(let ((source (or helm-saved-current-source (helm-get-current-source))) non-essential) (setq selection (helm-coerce-selection (or selection helm-saved-selection (helm-get-selection nil nil source) (and (assq 'accept-empty source) "")) source)) (if preserve-saved-action nil (setq helm-saved-action nil)) (if (and selection action) (progn (funcall action selection))))
helm-execute-selection-action-1()
(prog1 (helm-execute-selection-action-1) (helm-log-run-hook "helm-execute-selection-action" 'helm-after-action-hook))
(unwind-protect (prog1 (helm-execute-selection-action-1) (helm-log-run-hook "helm-execute-selection-action" 'helm-after-action-hook)) (setq helm--executing-helm-action nil))
helm-execute-selection-action()
(if helm--quit nil (helm-execute-selection-action))
(prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))
(let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested (minibufferp helm-current-buffer)) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins (selected-window) (+ (string-width helm-visible-mark-prefix) helm-left-margin-width))))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45)))))
(condition-case _v (let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested (minibufferp helm-current-buffer)) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins (selected-window) (+ (string-width helm-visible-mark-prefix) helm-left-margin-width))))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))) ((debug quit) (helm-restore-position-on-quit) (helm-log-run-hook "helm-internal" 'helm-quit-hook) (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 45))) nil))
(unwind-protect (condition-case _v (let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested (minibufferp helm-current-buffer)) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins (selected-window) (+ ... helm-left-margin-width))))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))) ((debug quit) (helm-restore-position-on-quit) (helm-log-run-hook "helm-internal" 'helm-quit-hook) (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 45))) nil)) (if (fboundp 'advice-remove) (progn (advice-remove 'tramp-read-passwd #'helm--suspend-read-passwd) (advice-remove 'ange-ftp-get-passwd #'helm--suspend-read-passwd) (advice-remove 'epa-passphrase-callback-function #'helm--suspend-read-passwd) (advice-remove 'linum-on #'helm--advice-linum-on))) (helm-log "helm-internal" "helm-alive-p = %S" (setq helm-alive-p nil)) (helm--remap-mouse-mode -1) (setq helm-alive-p nil) (and ori--minibuffer-follows-selected-frame (set-default-toplevel-value 'minibuffer-follows-selected-frame ori--minibuffer-follows-selected-frame)) (setq helm--force-updating-p nil) (setq helm--buffer-in-new-frame-p nil) (setq helm-pattern "") (progn (setq helm--ignore-errors nil) (setq helm-debug nil)))
(let ((non-essential t) mouse-autoselect-window focus-follows-mouse mode-line-in-non-selected-windows minibuffer-completion-confirm (ori--minibuffer-follows-selected-frame (and (boundp 'minibuffer-follows-selected-frame) (default-toplevel-value 'minibuffer-follows-selected-frame))) (input-method-verbose-flag helm-input-method-verbose-flag) (helm-maybe-use-default-as-input (and (null input) (or helm-maybe-use-default-as-input (let* ((--cl-var-- ...) (s nil) (--cl-flag-- t) --cl-var--) (while (and ... ...) (setq --cl-var-- ...)) --cl-var--))))) (unwind-protect (condition-case _v (let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested ...) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins ... ...)))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))) ((debug quit) (helm-restore-position-on-quit) (helm-log-run-hook "helm-internal" 'helm-quit-hook) (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 45))) nil)) (if (fboundp 'advice-remove) (progn (advice-remove 'tramp-read-passwd #'helm--suspend-read-passwd) (advice-remove 'ange-ftp-get-passwd #'helm--suspend-read-passwd) (advice-remove 'epa-passphrase-callback-function #'helm--suspend-read-passwd) (advice-remove 'linum-on #'helm--advice-linum-on))) (helm-log "helm-internal" "helm-alive-p = %S" (setq helm-alive-p nil)) (helm--remap-mouse-mode -1) (setq helm-alive-p nil) (and ori--minibuffer-follows-selected-frame (set-default-toplevel-value 'minibuffer-follows-selected-frame ori--minibuffer-follows-selected-frame)) (setq helm--force-updating-p nil) (setq helm--buffer-in-new-frame-p nil) (setq helm-pattern "") (progn (setq helm--ignore-errors nil) (setq helm-debug nil))))
helm-internal((helm-source-find-files helm-find-files-dummy-source) "/home/user/" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil)
apply(helm-internal ((helm-source-find-files helm-find-files-dummy-source) "/home/user/TODO" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil))
(if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist))
(if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist)))
(let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest)) (and helm-alive-p (memq ... plist))) #'helm--nest) ((keywordp (car plist)) #'helm) (t #'helm-internal)))) (if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda ... ...) helm-argument-keys))) (apply fn plist))))
helm((helm-source-find-files helm-find-files-dummy-source) "/home/user" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil)
apply(helm ((helm-source-find-files helm-find-files-dummy-source) "/home/user" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil))
(progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys)))
(if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist))
(if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist)))
(let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest)) (and helm-alive-p (memq ... plist))) #'helm--nest) ((keywordp (car plist)) #'helm) (t #'helm-internal)))) (if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda ... ...) helm-argument-keys))) (apply fn plist))))
helm(:sources (helm-source-find-files helm-find-files-dummy-source) :input "/home/user/" :case-fold-search smart :preselect "^[[:multibyte:] ]*cli2\\.py" :ff-transformer-show-only-basename t :dim-prompt-on-update t :default "/home/user/TODO" :prompt "Find files or url: " :buffer "*helm find files*")
(unwind-protect (helm :sources '(helm-source-find-files helm-find-files-dummy-source) :input fname :case-fold-search helm-file-name-case-fold-search :preselect preselect :ff-transformer-show-only-basename helm-ff-transformer-show-only-basename :dim-prompt-on-update helm-ff-dim-prompt-on-update :default def :prompt "Find files or url: " :buffer "*helm find files*") (helm-ff--update-resume-after-hook nil t) (setq helm-ff-default-directory nil))
(let* ((helm-ff-auto-update-initial-value (and helm-ff-auto-update-initial-value (not (minibuffer-window-active-p (minibuffer-window))))) (tap (thing-at-point 'filename)) (def (and tap (or (file-remote-p tap) (expand-file-name tap)))) (password-cache t)) (helm-set-local-variable 'helm-follow-mode-persistent nil 'helm-drag-mouse-1-fn 'helm-ff-drag-mouse-1-fn) (if helm-source-find-files nil (setq helm-source-find-files (helm-make-source "Find Files" 'helm-source-ffiles))) (if (helm-get-attr 'follow helm-source-find-files) (progn (helm-set-attr 'follow -1 helm-source-find-files))) (let ((it (and preselect (not helm-ff-preselect-ignore-large-dirs) (gethash fname helm-ff--directory-files-length helm-ff-candidate-number-limit)))) (if it (helm-set-attr 'candidate-number-limit (max it helm-ff-candidate-number-limit) helm-source-find-files))) (helm-ff-setup-update-hook) (add-hook 'helm-resume-after-hook 'helm-ff--update-resume-after-hook) (unwind-protect (helm :sources '(helm-source-find-files helm-find-files-dummy-source) :input fname :case-fold-search helm-file-name-case-fold-search :preselect preselect :ff-transformer-show-only-basename helm-ff-transformer-show-only-basename :dim-prompt-on-update helm-ff-dim-prompt-on-update :default def :prompt "Find files or url: " :buffer "*helm find files*") (helm-ff--update-resume-after-hook nil t) (setq helm-ff-default-directory nil)))
helm-find-files-1("/home/user/" "^[[:multibyte:] ]*cli2\\.py")
(let ((helm--executing-helm-action (not (null hist)))) (helm-find-files-1 input (and presel (null helm-ff-no-preselect) (format helm-ff-last-expanded-candidate-regexp (regexp-quote presel)))))
(let* (tramp-archive-enabled (hist (and arg helm-ff-history (helm-find-files-history nil))) (smart-input (or hist (helm-find-files-initial-input))) (default-input (expand-file-name (helm-current-directory))) (input (cond ((and (null hist) helm-find-files-ignore-thing-at-point) default-input) ((and (eq major-mode 'org-agenda-mode) org-directory (not smart-input)) (file-name-as-directory (expand-file-name org-directory))) ((and (eq major-mode 'dired-mode) smart-input) (file-name-directory smart-input)) ((and (not (string= smart-input "")) smart-input)) (t default-input))) (input-as-presel (null (file-directory-p input))) (presel (let ((it (or hist (and input-as-presel input) (buffer-file-name ...) (and ... smart-input) (and ... Info-current-file)))) (if it (if (and helm-ff-transformer-show-only-basename (null hist) (not ...)) (helm-basename it) it))))) (if (and hist (buffer-live-p (get-buffer helm-ff-history-buffer-name))) (progn (helm-set-local-variable 'helm-display-function (save-current-buffer (set-buffer helm-ff-history-buffer-name) helm-display-function) 'helm--last-frame-parameters (save-current-buffer (set-buffer helm-ff-history-buffer-name) helm--last-frame-parameters)))) (set-text-properties 0 (length input) nil input) (setq current-prefix-arg nil) (let ((helm--executing-helm-action (not (null hist)))) (helm-find-files-1 input (and presel (null helm-ff-no-preselect) (format helm-ff-last-expanded-candidate-regexp (regexp-quote presel))))))
helm-find-files(nil)
funcall-interactively(helm-find-files nil)
command-execute(helm-find-files)