Bug 1411079 - GNU Emacs 25.1: bug in setting syntax-highlighting for m files to that of GNU Octave
Summary: GNU Emacs 25.1: bug in setting syntax-highlighting for m files to that of GNU...
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: 25
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Synacek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-08 08:56 UTC by Brenton Horne
Modified: 2017-04-03 11:29 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-03 11:29:26 UTC
Type: Bug


Attachments (Terms of Use)

Description Brenton Horne 2017-01-08 08:56:51 UTC
Description of problem:
Adding:

(progn 
(autoload 'octave-mode "octave") 
(setq auto-mode-alist (cons '("\\.m\\'" . octave-mode) auto-mode-alist))) 

to one's ~/.emacs file does not cause files with the .m file extension to be syntax-highlighted using octave-mode. octave-mode is meant to come pre-installed with GNU Emacs. Using these lines in one's ~/.emacs file on another Linux distribution causes octave mode to load perfectly in GNU Emacs when opened to .m files. Likewise running GNU Emacs on Fedora 25 using an AppImage (specifically this one https://bintray.com/fusion809/AppImages/download_file?file_path=GNU_Emacs-25.1.90.glibc2.15-x86_64.AppImage) with these lines in the ~/.emacs file causes octave mode to load perfectly when Emacs is opened to a .m file. 

Version-Release number of selected component (if applicable):
25.1

How reproducible:


Steps to Reproduce:
1. Create a ~/.emacs file with the contents:

(progn 
(autoload 'octave-mode "octave") 
(setq auto-mode-alist (cons '("\\.m\\'" . octave-mode) auto-mode-alist))) 
2. Install GNU Emacs with (as root):

dnf install -y emacs

then open an m file (e.g., if you would like some m files written for GNU Octave specifically see this GitHub repository, it has plenty of example m files you can use https://github.com/fusion809/GNU_Octave)
3. Then see how GNU Emacs on another Linux distro, but with the same ~/.emacs file syntax-highlights the same m files... The difference is clear. Or, if another distro is not available for you to test this one you can download the AppImage (https://bintray.com/fusion809/AppImages/download_file?file_path=GNU_Emacs-25.1.90.glibc2.15-x86_64.AppImage), set its permissions properly and use it to open your m files and see the different in syntax-highlighting between Emacs installed with DNF and Emacs running from an AppImage. 

To download the AppImage, set its perms properly and run it to open an m file merely run (as standard user, NOT root!):

wget -c https://bintray.com/fusion809/AppImages/download_file?file_path=GNU_Emacs-25.1.90.glibc2.15-x86_64.AppImage -O GNU_Emacs-25.1.90.glibc2.15-x86_64.AppImage
chmod +x GNU_Emacs-25.1.90.glibc2.15-x86_64.AppImage
./GNU_Emacs-25.1.90.glibc2.15-x86_64.AppImage /path/to/mfile

Actual results:
Syntax-highlighting for m files in Emacs installed with DNF will be for Objective C files (Emacs' default) instead of being for GNU Octave m files (which is what it should be given the aforementioned ~/.emacs snippet). 

Expected results:
Syntax-highlighting should be for GNU Octave m files (utilizing the octave-mode that comes built-in with GNU Emacs). 

Additional info:
Further info can be found in this StackExchange chat room http://chat.stackexchange.com/rooms/49851/discussion-between-tobias-and-brenton-horne.

Comment 1 Jan Synacek 2017-01-16 13:00:30 UTC
(In reply to Brenton Horne from comment #0)
> Description of problem:
> Adding:
> 
> (progn 
> (autoload 'octave-mode "octave") 
> (setq auto-mode-alist (cons '("\\.m\\'" . octave-mode) auto-mode-alist))) 
> 
> to one's ~/.emacs file does not cause files with the .m file extension to be
> syntax-highlighted using octave-mode.

When I put that snippet into my ~/.emacs, .m files are opened in the octave-mode. Have you tried temporarily removing you .emacs and putting *only* these lines into it? Maybe it's a configuration problem. If it still doesn't work, please try running emacs -Q and then eval'ing the s-expression in the scratch buffer and opening a .m file.

Comment 2 Brenton Horne 2017-04-03 11:22:39 UTC
Sorry I have since ditched Fedora in favour of other distros, so I can't test this out. What I remember is that this bug was very persistent and bizarre. I thought it was an issue with GNU Emacs itself, but it turns out it was Fedora's packaging of it as on other distros the same config worked fine. Likewise if I used an AppImage on Fedora the config worked fine.


Note You need to log in before you can comment on or make changes to this bug.