Subject: bug#57972: 29.0.50; Autoloaded function raises (void-function org-element-cache-reset) when called within major-mode body

From: Ihor Radchenko <[email-masked]>
Date: Wed, 21 Sep 2022 22:51:16 +0800

>
> And another thing: do you have any clue (or maybe more than a clue)
> what changes in Org wrt what's on the Emacs master branch could have
> caused this?  If you do, can you show those changes, or point to the
> specific places in Org files where those changes can be eye-balled?

I bisected Org repo and found the first bad commit. Unfortunately, it is
not very useful.

The commit changed the order function calls in org-mode. Before the commit,
`org-setup-filling' got called prior to `org-element-cache-reset' and
 `org-setup-filling' has an explicit (require 'org-element) statement, which
  made autoloading unnecessary in the past.

Would it help to make the backtrace more detailed?  Right now, we
> don't see anything between the call to normal-mode and the error.  If
> you manually "M-x load-file RET files.el RET" before doing
> eval-buffer, do you get a more detailed backtrace?
>
>
Doing load-file made no difference.
I can generate an alternative backtrace using debug-on-entry org-mode.
The debug buffer right before error is below

Debugger entered--beginning evaluation of function call form:
* (org-element-cache-reset)
* (let ((delay-mode-hooks t)) (outline-mode) (setq major-mode 'org-mode)
(setq mode-name "Org") (progn (if (get 'outline-mode 'mode-class) (put
'org-mode 'mode-class (get 'outline-mode 'mode-class))) (if (keymap-parent
org-mode-map) nil (set-keymap-parent org-mode-map (current-local-map)))
(let ((parent (char-table-parent org-mode-syntax-table))) (if (and parent
(not (eq parent (standard-syntax-table)))) nil (set-char-table-parent
org-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get
org-mode-abbrev-table :parents) (eq org-mode-abbrev-table
local-abbrev-table)) nil (abbrev-table-put org-mode-abbrev-table :parents
(list local-abbrev-table)))) (use-local-map org-mode-map) (set-syntax-table
org-mode-syntax-table) (setq local-abbrev-table org-mode-abbrev-table) (set
(make-local-variable 'org-mode-loading) t) (org-load-modules-maybe) (if
org-agenda-file-menu-enabled (progn (org-install-agenda-files-menu))) (if
(and org-link-descriptive (eq org-fold-core-style 'overlays)) (progn
(add-to-invisibility-spec '(org-link)))) (org-fold-initialize (or (and
(stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis) "..."))
(make-local-variable 'org-link-descriptive) (if (eq org-fold-core-style
'overlays) (progn (add-to-invisibility-spec '(org-hide-block . t)))) (if
org-link-descriptive (org-fold-core-set-folding-spec-property (car
org-link--link-folding-spec) :visible nil)
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec)
:visible t)) (set (make-local-variable 'outline-regexp) org-outline-regexp)
(set (make-local-variable 'outline-level) 'org-outline-level) (if (and
(stringp org-ellipsis) (not (equal "" org-ellipsis))) (progn (if
org-display-table nil (setq org-display-table (make-display-table)))
(set-display-table-slot org-display-table 4 (vconcat (mapcar #'(lambda ...
...) org-ellipsis))) (setq buffer-display-table org-display-table)))
(org-set-regexps-and-options) (org-set-font-lock-defaults) (if (and
org-tag-faces (not org-tags-special-faces-re)) (progn (org-set-tag-faces
'org-tag-faces org-tag-faces))) (set (make-local-variable
'calc-embedded-open-mode) "# ") (modify-syntax-entry 34 "\"")
(modify-syntax-entry 92 "_") (modify-syntax-entry 126 "_")
(modify-syntax-entry 60 "(>") (modify-syntax-entry 62 ")<") (set
(make-local-variable 'font-lock-unfontify-region-function)
'org-unfontify-region) (set (make-local-variable
'org-table-may-need-update) t) (add-hook 'before-change-functions
'org-before-change-function nil 'local) (add-hook 'kill-buffer-hook
'org-check-running-clock nil 'local) (org-element-cache-reset) (if (and
org-element-cache-persistent org-element-use-cache) (progn
(org-persist-load 'org-element--cache (current-buffer) t)))
(org-macro-initialize-templates) (org-update-radio-target-regexp) (set
(make-local-variable 'indent-line-function) 'org-indent-line) (set
(make-local-variable 'indent-region-function) 'org-indent-region)
(org-setup-filling) (org-setup-comments-handling) (set (make-local-variable
'beginning-of-defun-function) 'org-backward-element) (set
(make-local-variable 'end-of-defun-function) #'(lambda nil (if (not
(org-at-heading-p)) (org-forward-element) (org-forward-element)
(forward-char -1)))) (set (make-local-variable 'next-error-function)
'org-occur-next-match) (set (make-local-variable
'add-log-current-defun-function) #'org-add-log-current-headline) (if
org-enforce-todo-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent) (remove-hook
'org-blocker-hook 'org-block-todo-from-children-or-siblings-or-parent)) (if
org-enforce-todo-checkbox-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-checkboxes) (remove-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)) (set (make-local-variable
'align-mode-rules-list) '((org-in-buffer-settings (regexp . "^[
\11]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") (modes quote (org-mode))))) (set
(make-local-variable 'pcomplete-command-completion-function)
#'org-pcomplete-initial) (set (make-local-variable
'pcomplete-command-name-function) #'org-command-at-point) ...)
* (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks
t)) (outline-mode) (setq major-mode 'org-mode) (setq mode-name "Org")
(progn (if (get 'outline-mode 'mode-class) (put 'org-mode 'mode-class (get
'outline-mode 'mode-class))) (if (keymap-parent org-mode-map) nil
(set-keymap-parent org-mode-map (current-local-map))) (let ((parent
(char-table-parent org-mode-syntax-table))) (if (and parent (not (eq parent
...))) nil (set-char-table-parent org-mode-syntax-table (syntax-table))))
(if (or (abbrev-table-get org-mode-abbrev-table :parents) (eq
org-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put
org-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map
org-mode-map) (set-syntax-table org-mode-syntax-table) (setq
local-abbrev-table org-mode-abbrev-table) (set (make-local-variable
'org-mode-loading) t) (org-load-modules-maybe) (if
org-agenda-file-menu-enabled (progn (org-install-agenda-files-menu))) (if
(and org-link-descriptive (eq org-fold-core-style 'overlays)) (progn
(add-to-invisibility-spec '(org-link)))) (org-fold-initialize (or (and
(stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis) "..."))
(make-local-variable 'org-link-descriptive) (if (eq org-fold-core-style
'overlays) (progn (add-to-invisibility-spec '(org-hide-block . t)))) (if
org-link-descriptive (org-fold-core-set-folding-spec-property (car
org-link--link-folding-spec) :visible nil)
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec)
:visible t)) (set (make-local-variable 'outline-regexp) org-outline-regexp)
(set (make-local-variable 'outline-level) 'org-outline-level) (if (and
(stringp org-ellipsis) (not (equal "" org-ellipsis))) (progn (if
org-display-table nil (setq org-display-table (make-display-table)))
(set-display-table-slot org-display-table 4 (vconcat (mapcar #'...
org-ellipsis))) (setq buffer-display-table org-display-table)))
(org-set-regexps-and-options) (org-set-font-lock-defaults) (if (and
org-tag-faces (not org-tags-special-faces-re)) (progn (org-set-tag-faces
'org-tag-faces org-tag-faces))) (set (make-local-variable
'calc-embedded-open-mode) "# ") (modify-syntax-entry 34 "\"")
(modify-syntax-entry 92 "_") (modify-syntax-entry 126 "_")
(modify-syntax-entry 60 "(>") (modify-syntax-entry 62 ")<") (set
(make-local-variable 'font-lock-unfontify-region-function)
'org-unfontify-region) (set (make-local-variable
'org-table-may-need-update) t) (add-hook 'before-change-functions
'org-before-change-function nil 'local) (add-hook 'kill-buffer-hook
'org-check-running-clock nil 'local) (org-element-cache-reset) (if (and
org-element-cache-persistent org-element-use-cache) (progn
(org-persist-load 'org-element--cache (current-buffer) t)))
(org-macro-initialize-templates) (org-update-radio-target-regexp) (set
(make-local-variable 'indent-line-function) 'org-indent-line) (set
(make-local-variable 'indent-region-function) 'org-indent-region)
(org-setup-filling) (org-setup-comments-handling) (set (make-local-variable
'beginning-of-defun-function) 'org-backward-element) (set
(make-local-variable 'end-of-defun-function) #'(lambda nil (if (not
(org-at-heading-p)) (org-forward-element) (org-forward-element)
(forward-char -1)))) (set (make-local-variable 'next-error-function)
'org-occur-next-match) (set (make-local-variable
'add-log-current-defun-function) #'org-add-log-current-headline) (if
org-enforce-todo-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent) (remove-hook
'org-blocker-hook 'org-block-todo-from-children-or-siblings-or-parent)) (if
org-enforce-todo-checkbox-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-checkboxes) (remove-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)) (set (make-local-variable
'align-mode-rules-list) '((org-in-buffer-settings (regexp . "^[
\11]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") (modes quote (org-mode))))) (set
(make-local-variable 'pcomplete-command-completion-function)
#'org-pcomplete-initial) (set (make-local-variable
'pcomplete-command-name-function) #'org-command-at-point) ...))
* (closure (org-mode-abbrev-table org-mode-syntax-table
org-element-use-cache org-element-cache-persistent buffer-face-mode-face
org-tbl-menu org-org-menu org-struct-menu org-entities org-last-state
org-id-track-globally org-clock-start-time texmathp-why remember-data-file
org-agenda-tags-todo-honor-ignore-options iswitchb-temp-buflist
calc-embedded-open-mode calc-embedded-open-formula
calc-embedded-close-formula align-mode-rules-list org-emphasis-alist
org-emphasis-regexp-components org-export-registered-backends org-modules
crm-separator org-babel-load-languages org-id-overriding-file-name
org-indent-indentation-per-level org-element--timestamp-regexp
org-element-cache-map-continue-from org-element-paragraph-separate
org-agenda-buffer-name org-inlinetask-min-level t) nil "Outline-based notes
management and organizer, alia..." (interactive) (progn
(make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t))
(outline-mode) (setq major-mode 'org-mode) (setq mode-name "Org") (progn
(if (get 'outline-mode 'mode-class) (put 'org-mode 'mode-class (get
'outline-mode 'mode-class))) (if (keymap-parent org-mode-map) nil
(set-keymap-parent org-mode-map (current-local-map))) (let ((parent
(char-table-parent org-mode-syntax-table))) (if (and parent (not ...)) nil
(set-char-table-parent org-mode-syntax-table (syntax-table)))) (if (or
(abbrev-table-get org-mode-abbrev-table :parents) (eq org-mode-abbrev-table
local-abbrev-table)) nil (abbrev-table-put org-mode-abbrev-table :parents
(list local-abbrev-table)))) (use-local-map org-mode-map) (set-syntax-table
org-mode-syntax-table) (setq local-abbrev-table org-mode-abbrev-table) (set
(make-local-variable 'org-mode-loading) t) (org-load-modules-maybe) (if
org-agenda-file-menu-enabled (progn (org-install-agenda-files-menu))) (if
(and org-link-descriptive (eq org-fold-core-style 'overlays)) (progn
(add-to-invisibility-spec '(org-link)))) (org-fold-initialize (or (and
(stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis) "..."))
(make-local-variable 'org-link-descriptive) (if (eq org-fold-core-style
'overlays) (progn (add-to-invisibility-spec '(org-hide-block . t)))) (if
org-link-descriptive (org-fold-core-set-folding-spec-property (car
org-link--link-folding-spec) :visible nil)
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec)
:visible t)) (set (make-local-variable 'outline-regexp) org-outline-regexp)
(set (make-local-variable 'outline-level) 'org-outline-level) (if (and
(stringp org-ellipsis) (not (equal "" org-ellipsis))) (progn (if
org-display-table nil (setq org-display-table (make-display-table)))
(set-display-table-slot org-display-table 4 (vconcat (mapcar ...
org-ellipsis))) (setq buffer-display-table org-display-table)))
(org-set-regexps-and-options) (org-set-font-lock-defaults) (if (and
org-tag-faces (not org-tags-special-faces-re)) (progn (org-set-tag-faces
'org-tag-faces org-tag-faces))) (set (make-local-variable
'calc-embedded-open-mode) "# ") (modify-syntax-entry 34 "\"")
(modify-syntax-entry 92 "_") (modify-syntax-entry 126 "_")
(modify-syntax-entry 60 "(>") (modify-syntax-entry 62 ")<") (set
(make-local-variable 'font-lock-unfontify-region-function)
'org-unfontify-region) (set (make-local-variable
'org-table-may-need-update) t) (add-hook 'before-change-functions
'org-before-change-function nil 'local) (add-hook 'kill-buffer-hook
'org-check-running-clock nil 'local) (org-element-cache-reset) (if (and
org-element-cache-persistent org-element-use-cache) (progn
(org-persist-load 'org-element--cache (current-buffer) t)))
(org-macro-initialize-templates) (org-update-radio-target-regexp) (set
(make-local-variable 'indent-line-function) 'org-indent-line) (set
(make-local-variable 'indent-region-function) 'org-indent-region)
(org-setup-filling) (org-setup-comments-handling) (set (make-local-variable
'beginning-of-defun-function) 'org-backward-element) (set
(make-local-variable 'end-of-defun-function) #'(lambda nil (if (not ...)
(org-forward-element) (org-forward-element) (forward-char -1)))) (set
(make-local-variable 'next-error-function) 'org-occur-next-match) (set
(make-local-variable 'add-log-current-defun-function)
#'org-add-log-current-headline) (if org-enforce-todo-dependencies (add-hook
'org-blocker-hook 'org-block-todo-from-children-or-siblings-or-parent)
(remove-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent)) (if
org-enforce-todo-checkbox-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-checkboxes) (remove-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)) (set (make-local-variable
'align-mode-rules-list) '((org-in-buffer-settings (regexp . "^[
\11]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") (modes quote ...)))) (set
(make-local-variable 'pcomplete-command-completion-function)
#'org-pcomplete-initial) (set (make-local-variable
'pcomplete-command-name-function) #'org-command-at-point) ...))
(run-mode-hooks 'org-mode-hook))()
* apply((closure (org-mode-abbrev-table org-mode-syntax-table
org-element-use-cache org-element-cache-persistent buffer-face-mode-face
org-tbl-menu org-org-menu org-struct-menu org-entities org-last-state
org-id-track-globally org-clock-start-time texmathp-why remember-data-file
org-agenda-tags-todo-honor-ignore-options iswitchb-temp-buflist
calc-embedded-open-mode calc-embedded-open-formula
calc-embedded-close-formula align-mode-rules-list org-emphasis-alist
org-emphasis-regexp-components org-export-registered-backends org-modules
crm-separator org-babel-load-languages org-id-overriding-file-name
org-indent-indentation-per-level org-element--timestamp-regexp
org-element-cache-map-continue-from org-element-paragraph-separate
org-agenda-buffer-name org-inlinetask-min-level t) nil "Outline-based notes
management and organizer, alia..." (interactive) (progn
(make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t))
(outline-mode) (setq major-mode 'org-mode) (setq mode-name "Org") (progn
(if (get 'outline-mode 'mode-class) (put 'org-mode 'mode-class (get ...
...))) (if (keymap-parent org-mode-map) nil (set-keymap-parent org-mode-map
(current-local-map))) (let ((parent ...)) (if (and parent ...) nil
(set-char-table-parent org-mode-syntax-table ...))) (if (or
(abbrev-table-get org-mode-abbrev-table :parents) (eq org-mode-abbrev-table
local-abbrev-table)) nil (abbrev-table-put org-mode-abbrev-table :parents
(list local-abbrev-table)))) (use-local-map org-mode-map) (set-syntax-table
org-mode-syntax-table) (setq local-abbrev-table org-mode-abbrev-table) (set
(make-local-variable 'org-mode-loading) t) (org-load-modules-maybe) (if
org-agenda-file-menu-enabled (progn (org-install-agenda-files-menu))) (if
(and org-link-descriptive (eq org-fold-core-style 'overlays)) (progn
(add-to-invisibility-spec '...))) (org-fold-initialize (or (and (stringp
org-ellipsis) (not ...) org-ellipsis) "...")) (make-local-variable
'org-link-descriptive) (if (eq org-fold-core-style 'overlays) (progn
(add-to-invisibility-spec '...))) (if org-link-descriptive
(org-fold-core-set-folding-spec-property (car org-link--link-folding-spec)
:visible nil) (org-fold-core-set-folding-spec-property (car
org-link--link-folding-spec) :visible t)) (set (make-local-variable
'outline-regexp) org-outline-regexp) (set (make-local-variable
'outline-level) 'org-outline-level) (if (and (stringp org-ellipsis) (not
(equal "" org-ellipsis))) (progn (if org-display-table nil (setq
org-display-table ...)) (set-display-table-slot org-display-table 4
(vconcat ...)) (setq buffer-display-table org-display-table)))
(org-set-regexps-and-options) (org-set-font-lock-defaults) (if (and
org-tag-faces (not org-tags-special-faces-re)) (progn (org-set-tag-faces
'org-tag-faces org-tag-faces))) (set (make-local-variable
'calc-embedded-open-mode) "# ") (modify-syntax-entry 34 "\"")
(modify-syntax-entry 92 "_") (modify-syntax-entry 126 "_")
(modify-syntax-entry 60 "(>") (modify-syntax-entry 62 ")<") (set
(make-local-variable 'font-lock-unfontify-region-function)
'org-unfontify-region) (set (make-local-variable
'org-table-may-need-update) t) (add-hook 'before-change-functions
'org-before-change-function nil 'local) (add-hook 'kill-buffer-hook
'org-check-running-clock nil 'local) (org-element-cache-reset) (if (and
org-element-cache-persistent org-element-use-cache) (progn
(org-persist-load 'org-element--cache (current-buffer) t)))
(org-macro-initialize-templates) (org-update-radio-target-regexp) (set
(make-local-variable 'indent-line-function) 'org-indent-line) (set
(make-local-variable 'indent-region-function) 'org-indent-region)
(org-setup-filling) (org-setup-comments-handling) (set (make-local-variable
'beginning-of-defun-function) 'org-backward-element) (set
(make-local-variable 'end-of-defun-function) #'(lambda nil (if ... ... ...
...))) (set (make-local-variable 'next-error-function)
'org-occur-next-match) (set (make-local-variable
'add-log-current-defun-function) #'org-add-log-current-headline) (if
org-enforce-todo-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent) (remove-hook
'org-blocker-hook 'org-block-todo-from-children-or-siblings-or-parent)) (if
org-enforce-todo-checkbox-dependencies (add-hook 'org-blocker-hook
'org-block-todo-from-checkboxes) (remove-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)) (set (make-local-variable
'align-mode-rules-list) '((org-in-buffer-settings ... ...))) (set
(make-local-variable 'pcomplete-command-completion-function)
#'org-pcomplete-initial) (set (make-local-variable
'pcomplete-command-name-function) #'org-command-at-point) ...))
(run-mode-hooks 'org-mode-hook)) nil)
* org-mode()
  funcall(org-mode)
  (progn (funcall mode) mode)
  (if mode (progn (funcall mode) mode))
  (if (and keep-mode-if-same (eq (indirect-function mode)
(indirect-function major-mode))) nil (if mode (progn (funcall mode) mode)))
  set-auto-mode-0(org-mode nil)
  (progn (set-auto-mode-0 mode keep-mode-if-same) t)
  (if mode (progn (set-auto-mode-0 mode keep-mode-if-same) t))
  (let (mode (name buffer-file-name) (remote-id (file-remote-p
buffer-file-name)) (case-insensitive-p (file-name-case-insensitive-p
buffer-file-name))) (setq name (file-name-sans-versions name)) (if (and
(stringp remote-id) (string-match (regexp-quote remote-id) name)) (progn
(setq name (substring name (match-end 0))))) (while name (setq mode (if
case-insensitive-p (let ((case-fold-search t)) (assoc-default name alist
'string-match)) (or (let ((case-fold-search nil)) (assoc-default name alist
'string-match)) (and auto-mode-case-fold (let (...) (assoc-default name
alist ...)))))) (if (and mode (not (functionp mode)) (consp mode) (car (cdr
mode))) (progn (setq mode (car mode)) (setq name (substring name 0
(match-beginning 0)))) (setq name nil))) (if (and dir-local mode (not
(set-auto-mode--dir-local-valid-p mode))) (progn (message "Ignoring invalid
mode `%s'" mode) (setq mode nil))) (if mode (progn (set-auto-mode-0 mode
keep-mode-if-same) t)))
  (if buffer-file-name (let (mode (name buffer-file-name) (remote-id
(file-remote-p buffer-file-name)) (case-insensitive-p
(file-name-case-insensitive-p buffer-file-name))) (setq name
(file-name-sans-versions name)) (if (and (stringp remote-id) (string-match
(regexp-quote remote-id) name)) (progn (setq name (substring name
(match-end 0))))) (while name (setq mode (if case-insensitive-p (let
((case-fold-search t)) (assoc-default name alist 'string-match)) (or (let
(...) (assoc-default name alist ...)) (and auto-mode-case-fold (let ...
...))))) (if (and mode (not (functionp mode)) (consp mode) (car (cdr
mode))) (progn (setq mode (car mode)) (setq name (substring name 0
(match-beginning 0)))) (setq name nil))) (if (and dir-local mode (not
(set-auto-mode--dir-local-valid-p mode))) (progn (message "Ignoring invalid
mode `%s'" mode) (setq mode nil))) (if mode (progn (set-auto-mode-0 mode
keep-mode-if-same) t))))
  set-auto-mode--apply-alist((("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil
epa-file) ("\\.elc\\'" . elisp-byte-code-mode)
("\\.\\(?:3fr\\|a\\(?:rw\\|vs\\)\\|bmp[23]?\\|c\\(?:als?\\|myk..." .
image-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\\|jbuilder\\|rabl\\|ge..." .
ruby-mode) ("\\.re?st\\'" . rst-mode) ("\\.py[iw]?\\'" . python-mode)
("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode)
("\\.scss\\'" . scss-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) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" .
c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" .
bat-mode) ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode)
("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode) ("\\.x[bp]m\\'" .
image-mode) ("\\.x[bp]m\\'" . c-mode) ("\\.p[bpgn]m\\'" . image-mode)
("\\.tiff?\\'" . image-mode) ("\\.gif\\'" . image-mode) ("\\.png\\'" .
image-mode) ("\\.jpe?g\\'" . image-mode) ("\\.webp\\'" . image-mode)
("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ins\\'" .
tex-mode) ("\\.ltx\\'" . latex-mode) ("\\.dtx\\'" . doctex-mode)
("\\.org\\'" . org-mode) ...) nil nil)
  (setq done (set-auto-mode--apply-alist auto-mode-alist keep-mode-if-same
nil))
  (if done nil (setq done (set-auto-mode--apply-alist auto-mode-alist
keep-mode-if-same nil)))
  (let ((try-locals (not (inhibit-local-variables-p))) end done mode modes)
(save-excursion (goto-char (point-min)) (skip-chars-forward " \11\n") (and
enable-local-variables try-locals (setq end (set-auto-mode-1)) (if
(save-excursion (search-forward ":" end t)) (while (let ((case-fold-search
t)) (or (and ... ...) (re-search-forward "[ \11;]mode:" end t)))
(skip-chars-forward " \11") (let ((beg ...)) (if (search-forward ";" end t)
(forward-char -1) (goto-char end)) (skip-chars-backward " \11") (setq modes
(cons ... modes)))) (setq modes (cons (intern (concat ... "-mode"))
modes))))) (if modes (catch 'nop (let ((--dolist-tail-- (nreverse modes)))
(while --dolist-tail-- (let ((mode ...)) (if (not ...) (message "Ignoring
unknown mode `%s'" mode) (setq done t) (or ... ...)) (setq --dolist-tail--
(cdr --dolist-tail--))))))) (if done nil (condition-case err (let*
((mode-alist (cdr (hack-dir-local--get-variables ...)))) (setq done
(set-auto-mode--apply-alist mode-alist keep-mode-if-same t))) ((debug
error) (message "Directory-local variables error: %s" err) nil))) (and (not
done) (setq mode (hack-local-variables t (not try-locals))) (not (memq mode
modes)) (if (not (functionp mode)) (message "Ignoring unknown mode `%s'"
mode) (setq done t) (set-auto-mode-0 mode keep-mode-if-same))) (and (not
done) (setq mode (save-excursion (goto-char (point-min)) (if (looking-at
auto-mode-interpreter-regexp) (match-string 2)))) (setq done (assoc-default
(file-name-nondirectory mode) (mapcar #'(lambda (e) (cons ... ...))
interpreter-mode-alist) #'string-match-p)) (set-auto-mode-0 done
keep-mode-if-same)) (if done nil (if (setq done (save-excursion (goto-char
(point-min)) (save-restriction (narrow-to-region (point-min) (min ... ...))
(assoc-default nil magic-mode-alist #'...)))) (set-auto-mode-0 done
keep-mode-if-same))) (if done nil (setq done (set-auto-mode--apply-alist
auto-mode-alist keep-mode-if-same nil))) (if done nil (if (setq done
(save-excursion (goto-char (point-min)) (save-restriction (narrow-to-region
(point-min) (min ... ...)) (assoc-default nil magic-fallback-mode-alist
#'...)))) (set-auto-mode-0 done keep-mode-if-same))) (if done nil
(set-buffer-major-mode (current-buffer))))
  set-auto-mode()
  (condition-case err (set-auto-mode) ((debug error) (message "File mode
specification error: %s" err) nil))
  (let ((enable-local-variables (or (not find-file)
enable-local-variables))) (condition-case err (set-auto-mode) ((debug
error) (message "File mode specification error: %s" err) nil)) (if
delay-mode-hooks (progn (condition-case err (hack-local-variables 'no-mode)
((debug error) (message "File local-variables error: %s" err) nil)))))
  normal-mode(t)
  (if nomodes nil (if (and view-read-only view-mode) (progn (view-mode
-1))) (normal-mode t) (and (memq require-final-newline '(visit visit-save))
(> (point-max) (point-min)) (/= (char-after (1- (point-max))) 10) (not (and
(eq selective-display t) (= (char-after (1- (point-max))) 13))) (not
buffer-read-only) (save-excursion (goto-char (point-max)) (condition-case
nil (progn (insert "\n")) (error nil)))) (if (and buffer-read-only
view-read-only (not (eq (get major-mode 'mode-class) 'special))) (progn
(view-mode-enter))) (run-hooks 'find-file-hook))
  after-find-file(nil t)
  (if rawfile (let ((enable-local-variables nil)) (set-buffer-multibyte
nil) (setq buffer-file-coding-system 'no-conversion) (set-buffer-major-mode
buf) (set (make-local-variable 'find-file-literally) t)) (after-find-file
error (not nowarn)))
  (save-current-buffer (set-buffer buf) (kill-local-variable
'find-file-literally) (kill-local-variable 'buffer-file-coding-system)
(kill-local-variable 'cursor-type) (let ((inhibit-read-only t))
(erase-buffer)) (and (not rawfile) (set-buffer-multibyte t)) (if rawfile
(condition-case nil (let ((inhibit-read-only t) (enable-local-variables
nil)) (insert-file-contents-literally filename t)) (file-error (if (and
(file-exists-p filename) (not (file-readable-p filename))) (progn
(kill-buffer buf) (signal 'file-error (list "File is not readable"
filename)))) (setq error t))) (condition-case nil (let ((inhibit-read-only
t)) (insert-file-contents filename t)) (file-error (if (and (file-exists-p
filename) (not (file-readable-p filename))) (progn (kill-buffer buf)
(signal 'file-error (list "File is not readable" filename)))) (or
(run-hook-with-args-until-success 'find-file-not-found-functions) (setq
error t))))) (setq buffer-file-truename (if (equal filename
buffer-file-name) truename (abbreviate-file-name (file-truename
buffer-file-name)))) (setq buffer-file-number number) (if
find-file-visit-truename (setq buffer-file-name (expand-file-name
buffer-file-truename))) (setq default-directory (file-name-directory
buffer-file-name)) (and backup-enable-predicate (not (funcall
backup-enable-predicate buffer-file-name)) (set (make-local-variable
'backup-inhibited) t)) (if rawfile (let ((enable-local-variables nil))
(set-buffer-multibyte nil) (setq buffer-file-coding-system 'no-conversion)
(set-buffer-major-mode buf) (set (make-local-variable 'find-file-literally)
t)) (after-find-file error (not nowarn))) (current-buffer))
  (let (error) (save-current-buffer (set-buffer buf) (kill-local-variable
'find-file-literally) (kill-local-variable 'buffer-file-coding-system)
(kill-local-variable 'cursor-type) (let ((inhibit-read-only t))
(erase-buffer)) (and (not rawfile) (set-buffer-multibyte t)) (if rawfile
(condition-case nil (let ((inhibit-read-only t) (enable-local-variables
nil)) (insert-file-contents-literally filename t)) (file-error (if (and
(file-exists-p filename) (not ...)) (progn (kill-buffer buf) (signal ...
...))) (setq error t))) (condition-case nil (let ((inhibit-read-only t))
(insert-file-contents filename t)) (file-error (if (and (file-exists-p
filename) (not ...)) (progn (kill-buffer buf) (signal ... ...))) (or
(run-hook-with-args-until-success 'find-file-not-found-functions) (setq
error t))))) (setq buffer-file-truename (if (equal filename
buffer-file-name) truename (abbreviate-file-name (file-truename
buffer-file-name)))) (setq buffer-file-number number) (if
find-file-visit-truename (setq buffer-file-name (expand-file-name
buffer-file-truename))) (setq default-directory (file-name-directory
buffer-file-name)) (and backup-enable-predicate (not (funcall
backup-enable-predicate buffer-file-name)) (set (make-local-variable
'backup-inhibited) t)) (if rawfile (let ((enable-local-variables nil))
(set-buffer-multibyte nil) (setq buffer-file-coding-system 'no-conversion)
(set-buffer-major-mode buf) (set (make-local-variable 'find-file-literally)
t)) (after-find-file error (not nowarn))) (current-buffer)))
  find-file-noselect-1(#<buffer bug.org> "/tmp/bug.org" nil nil "/tmp/
bug.org" (127741036 26))
  (if buf (let (nonexistent) (or nowarn (verify-visited-file-modtime buf)
(cond ((not (file-exists-p filename)) (setq nonexistent t) (message "File
%s no longer exists!" filename)) ((and (not (buffer-modified-p buf)) (let
(... ...) (while tail ... ...) found)) (save-current-buffer (set-buffer
buf) (message "Reverting file %s..." filename) (revert-buffer t t) (message
"Reverting file %s...done" filename))) ((not query-about-changed-file)
(message (substitute-command-keys "File %s changed on disk.
 \\[revert-buffer-quick] t...") (file-name-nondirectory filename) (if
(buffer-modified-p buf) " and discard your edits" ""))) ((yes-or-no-p (if
(string= ... ...) (format ... ...) (format ... ... ...)))
(save-current-buffer (set-buffer buf) (revert-buffer t t)))))
(save-current-buffer (set-buffer buf) (let ((read-only (not
(file-writable-p buffer-file-name)))) (if (or nonexistent (eq read-only
buffer-file-read-only) (eq read-only buffer-read-only)) nil (if (or nowarn
(let* ... ...)) (progn (setq buffer-read-only read-only)))) (setq
buffer-file-read-only read-only)) (if (or (eq (null rawfile) (null
find-file-literally)) nonexistent (memq major-mode '(hexl-mode
image-mode))) nil (if (buffer-modified-p) (if (let (...) (y-or-n-p ...))
(progn (save-buffer) (find-file-noselect-1 buf filename nowarn rawfile
truename number)) (if (y-or-n-p ...) (find-file-noselect-1 buf filename
nowarn rawfile truename number) (error ...))) (if (let (...) (y-or-n-p
...)) (find-file-noselect-1 buf filename nowarn rawfile truename number)
(error (if rawfile "File already visited non-literally" "File already
visited literally")))))) buf) (setq buf (create-file-buffer filename))
(find-file-noselect-1 buf filename nowarn rawfile truename number))
  (let* ((buf (get-file-buffer filename)) (truename (abbreviate-file-name
(file-truename filename))) (attributes (file-attributes truename)) (number
(nthcdr 10 attributes)) (other (and (not buf) (find-buffer-visiting
filename #'(lambda (buffer) (let ... ...)))))) (if other (progn (or nowarn
find-file-suppress-same-file-warnings (string-equal filename
(buffer-file-name other)) (files--message "%s and %s are the same file"
filename (buffer-file-name other))) (if (or find-file-existing-other-name
find-file-visit-truename) (setq buf other)))) (if (not (or buf nowarn))
(progn (if (eq (abort-if-file-too-large (file-attribute-size attributes)
"open" filename (not rawfile)) 'raw) (progn (setq rawfile t)))
(warn-maybe-out-of-memory (file-attribute-size attributes)))) (if buf (let
(nonexistent) (or nowarn (verify-visited-file-modtime buf) (cond ((not
(file-exists-p filename)) (setq nonexistent t) (message "File %s no longer
exists!" filename)) ((and (not ...) (let ... ... found))
(save-current-buffer (set-buffer buf) (message "Reverting file %s..."
filename) (revert-buffer t t) (message "Reverting file %s...done"
filename))) ((not query-about-changed-file) (message
(substitute-command-keys "File %s changed on disk.  \\[revert-buffer-quick]
t...") (file-name-nondirectory filename) (if ... " and discard your edits"
""))) ((yes-or-no-p (if ... ... ...)) (save-current-buffer (set-buffer buf)
(revert-buffer t t))))) (save-current-buffer (set-buffer buf) (let
((read-only (not ...))) (if (or nonexistent (eq read-only
buffer-file-read-only) (eq read-only buffer-read-only)) nil (if (or nowarn
...) (progn ...))) (setq buffer-file-read-only read-only)) (if (or (eq
(null rawfile) (null find-file-literally)) nonexistent (memq major-mode
'...)) nil (if (buffer-modified-p) (if (let ... ...) (progn ... ...) (if
... ... ...)) (if (let ... ...) (find-file-noselect-1 buf filename nowarn
rawfile truename number) (error ...))))) buf) (setq buf (create-file-buffer
filename)) (find-file-noselect-1 buf filename nowarn rawfile truename
number)))
  (if (and wildcards find-file-wildcards (not (file-name-quoted-p
filename)) (string-match "[[*?]" filename)) (let ((files (condition-case
nil (file-expand-wildcards filename t) (error (list filename))))
(find-file-wildcards nil)) (if (null files) (find-file-noselect filename)
(mapcar #'find-file-noselect files))) (let* ((buf (get-file-buffer
filename)) (truename (abbreviate-file-name (file-truename filename)))
(attributes (file-attributes truename)) (number (nthcdr 10 attributes))
(other (and (not buf) (find-buffer-visiting filename #'(lambda ... ...)))))
(if other (progn (or nowarn find-file-suppress-same-file-warnings
(string-equal filename (buffer-file-name other)) (files--message "%s and %s
are the same file" filename (buffer-file-name other))) (if (or
find-file-existing-other-name find-file-visit-truename) (setq buf other))))
(if (not (or buf nowarn)) (progn (if (eq (abort-if-file-too-large
(file-attribute-size attributes) "open" filename (not rawfile)) 'raw)
(progn (setq rawfile t))) (warn-maybe-out-of-memory (file-attribute-size
attributes)))) (if buf (let (nonexistent) (or nowarn
(verify-visited-file-modtime buf) (cond ((not ...) (setq nonexistent t)
(message "File %s no longer exists!" filename)) ((and ... ...)
(save-current-buffer ... ... ... ...)) ((not query-about-changed-file)
(message ... ... ...)) ((yes-or-no-p ...) (save-current-buffer ... ...))))
(save-current-buffer (set-buffer buf) (let ((read-only ...)) (if (or
nonexistent ... ...) nil (if ... ...)) (setq buffer-file-read-only
read-only)) (if (or (eq ... ...) nonexistent (memq major-mode ...)) nil (if
(buffer-modified-p) (if ... ... ...) (if ... ... ...)))) buf) (setq buf
(create-file-buffer filename)) (find-file-noselect-1 buf filename nowarn
rawfile truename number))))
  (if (file-directory-p filename) (or (and find-file-run-dired
(run-hook-with-args-until-success 'find-directory-functions (if
find-file-visit-truename (abbreviate-file-name (file-truename filename))
filename))) (error "%s is a directory" filename)) (if (and wildcards
find-file-wildcards (not (file-name-quoted-p filename)) (string-match
"[[*?]" filename)) (let ((files (condition-case nil (file-expand-wildcards
filename t) (error (list filename)))) (find-file-wildcards nil)) (if (null
files) (find-file-noselect filename) (mapcar #'find-file-noselect files)))
(let* ((buf (get-file-buffer filename)) (truename (abbreviate-file-name
(file-truename filename))) (attributes (file-attributes truename)) (number
(nthcdr 10 attributes)) (other (and (not buf) (find-buffer-visiting
filename #'...)))) (if other (progn (or nowarn
find-file-suppress-same-file-warnings (string-equal filename
(buffer-file-name other)) (files--message "%s and %s are the same file"
filename (buffer-file-name other))) (if (or find-file-existing-other-name
find-file-visit-truename) (setq buf other)))) (if (not (or buf nowarn))
(progn (if (eq (abort-if-file-too-large ... "open" filename ...) 'raw)
(progn (setq rawfile t))) (warn-maybe-out-of-memory (file-attribute-size
attributes)))) (if buf (let (nonexistent) (or nowarn
(verify-visited-file-modtime buf) (cond (... ... ...) (... ...) (... ...)
(... ...))) (save-current-buffer (set-buffer buf) (let (...) (if ... nil
...) (setq buffer-file-read-only read-only)) (if (or ... nonexistent ...)
nil (if ... ... ...))) buf) (setq buf (create-file-buffer filename))
(find-file-noselect-1 buf filename nowarn rawfile truename number)))))
  find-file-noselect("/tmp/bug.org" nil nil t)
  (let ((value (find-file-noselect filename nil nil wildcards))) (if (listp
value) (mapcar 'pop-to-buffer-same-window (nreverse value))
(pop-to-buffer-same-window value)))
  find-file("/tmp/bug.org" t)
  funcall-interactively(find-file "/tmp/bug.org" t)
  command-execute(find-file)