0

When I open file with C-x C-f (counsel-find-file &optional INITIAL-INPUT)

Most of the org files are opened as org-mode automatically, yet there are a few displayed as plain text as fundamental mode.

What's the problem it might be?

The example is the Chapter 5 of SICP

enter image description here

Issue M: and eval (cl-rassoc 'org-mode auto-mode-alist), get output

("\\.org\\'" . org-mode)

enter image description here

Emacs 26.3 
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11) of 2019-09-23, modified by Debian

the machine info:

OS: Ubuntu 19.10 x86_64 
Host: MacBookPro11,1 1.0 
Kernel: 5.3.0-24-generic 
Uptime: 7 hours, 54 mins 
Packages: 2601 (dpkg), 2 (snap) 
Shell: bash 5.0.3 
Resolution: 2560x1600 
DE: KDE 
WM: KWin 
Wizard
  • 1,251
  • 6
  • 17
  • What keyboard shortcut are you using to open the file, and what is the name of the function that is triggered? C-h k and then type the keyboard shortcut to see which function is bound. Also, do you have a minimal working example of a file that the behavior is exhibited? If we have that information, then we can probably do away with our crystal ball when trying to answer this question. :) – lawlist Jan 07 '20 at 07:46
  • Maybe have a look at section 23.3 "Choosing file modes" of the manual. – JeanPierre Jan 07 '20 at 08:21
  • Please type M-: and thereafter in the minibuffer (cl-rassoc 'org-mode auto-mode-alist) followed by the RETURN key. Add the value that is output to the *Messages* buffer to your question. – Tobias Jan 07 '20 at 10:37
  • ty, it print org\\'" . org-mode) . @Tobias – Wizard Jan 07 '20 at 13:02
  • This looks wrong but I'm not sure whether it's a cut-and-paste error: is there no opening parenthesis and no opening double quote? In my case, I get ("\\.org$" . org-mode) . Note that also the pattern is different in my case: you might want to check the setting of auto-mode-alist. – NickD Jan 07 '20 at 13:55
  • @NickD ("\\.org\\'" . org-mode) is also fine. Actually, it is closer to what is meant. The expression $ at the end of the regexp is the match of the empty string at the end of line while \\' is the match of the empty string at the end of input, i.e., the string. A string may contain multiple lines. Then $ and \\' can give different results. – Tobias Jan 07 '20 at 14:03
  • I am so sorry it cut-and-paste error and it's in auto-mode-alist. I wonder if emacs has some mechanism which set fundamental mode automatically for so-long text? @NickD – Wizard Jan 07 '20 at 14:12
  • What operating system and version of Emacs are you using (try M-x emacs-version)? Do the files with this problem have anything in common - same directory, similar name, any comments at the beginning or end of the files? – Tyler Jan 07 '20 at 14:28
  • emacs 26.3 on ubuntu 19.10 @Tyler – Wizard Jan 07 '20 at 14:33
  • Does the problem persist when you start emacs via emacs -Q? – Tyler Jan 07 '20 at 14:39
  • N0, it works perfectly in a vanilla emacs @Tyler – Wizard Jan 07 '20 at 15:16
  • 1
    ok. The problem is in your personal configuration then, and we'll have a hard time helping remotely. See here: https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems – Tyler Jan 07 '20 at 15:56

0 Answers0