Hey, just a thought I had. Vim has syntax highlighting for these files, so I thought it can't be impossible on emacs to have. Not sure if ebuild-mode is the correct package for that, or should some more generic package be created (like, gentoo-mode)? Thoughts and other input appreciated.
I'd suggest using conf-mode for this. The problem is more to come up with a definitive list of filenames for which it should be activated. There is a list in the portage(5) manpage, but we'll have to see which files we want.
Something like worked for me so far (note that I'm a first-timer writing lisp), diff -Naur ebuild-mode-1.50/ebuild-mode.el ebuild-mode-1.51/ebuild-mode.el --- ebuild-mode-1.50/ebuild-mode.el 2020-03-08 00:36:27.000000000 +0200 +++ ebuild-mode-1.51/ebuild-mode.el 2020-06-23 13:54:33.203458004 +0300 @@ -555,7 +555,8 @@ "\n" ;; dependencies "RDEPEND=\"\"\n" - "DEPEND=\"\$\{RDEPEND\}\"\n") + "DEPEND=\"\$\{RDEPEND\}\"\n" + "BDEPEND=\"\"\n") ;;; Keybindings. @@ -589,6 +590,10 @@ ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(ebuild\\|eclass\\)\\'" . ebuild-mode)) +;;; Enable conf-mode for Gentoo-specific /etc/portage config files, +(add-to-list 'auto-mode-alist '( + "\\package.\\(accept_keywords\\|env\\|mask\\|unmask\\|use\\)\\'" . conf-mode)) + (provide 'ebuild-mode) ;; Local Variables: At least package.unmask seems a bit redundant, but it's there for consistency's sake.
Here's the full list of 'man 5 portage' file names: https://dev.gentoo.org/~juippis/tmp/etcportagefilenames.txt First of all we can obviously ignore any .conf files, since they get conf-mode enabled by default. (make.conf, repo.conf, sets.conf, env.conf) From a user's point of view, let's focus on /etc/portage/: - as a Gentoo emacs user, I'd say the following list would benefit me: - package.{accept_keywords,env,mask,unmask,use}, - which leaves out: - bashrc, - package.{accept_restrict,keywords(deprecated),license,properties} - random files which I have no idea about their content, probably not relevant to users - even package.mask and .unmask are a bit questionable, since they only have one entry per-line, but conf-mode follows color scheme better than Fundamental. Now on a Gentoo dev's point of view, we must also include /var/db/repos/gentoo/profiles/ because every now and then we edit these files: - package.{mask,unmask,use{.force,.mask,.stable.force,.stable.mask}} - use.{force,mask,stable.mask,stable.force} Maybe add conf-mode for /var/lib/portage/world{_sets}. Same rationale as with .mask & .unmask, conf-mode supports my colorscheme better than Fundamental. I believe from a user's and developers' point of view, rest can be ignored. So this'd be the final list, in a simple form: package.accept_keywords package.env package.mask package.unmask package.use package.use.force package.use.mask package.use.stable.force package.use.stable.mask use.force use.mask use.stable.mask use.stable.force (/var/lib/portage/)world (/var/lib/portage/)world_sets Some regexp magic can surely be used here. () indicate a possible full path instead of blankly matching per file name.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=266c57d3caec4df8fe747e10cfbf8cf55cf7de70 commit 266c57d3caec4df8fe747e10cfbf8cf55cf7de70 Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2020-07-21 20:25:42 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2020-07-21 20:26:30 +0000 app-emacs/ebuild-mode: Version bump to 1.51. Closes: https://bugs.gentoo.org/698750 Package-Manager: Portage-3.0.0, Repoman-2.3.23 Signed-off-by: Ulrich Müller <ulm@gentoo.org> app-emacs/ebuild-mode/Manifest | 1 + app-emacs/ebuild-mode/ebuild-mode-1.51.ebuild | 22 ++++++++++++++++++++++ .../ebuild-mode/files/50ebuild-mode-gentoo-1.51.el | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+)
I've enabled conf-mode via the site-init file in ebuild-mode-1.51: (add-to-list 'auto-mode-alist '("/\\(package\\.\\(use\\|env\ \\|license\\|properties\\|accept_\\(keywords\\|restrict\\)\\)\ \\|\\(package\\.\\)?use.\\(stable\\.\\)?\\(force\\|mask\\)\\)\\'" . conf-mode))
(In reply to Ulrich Müller from comment #5) > I've enabled conf-mode via the site-init file in ebuild-mode-1.51: > > (add-to-list 'auto-mode-alist > '("/\\(package\\.\\(use\\|env\ > \\|license\\|properties\\|accept_\\(keywords\\|restrict\\)\\)\ > \\|\\(package\\.\\)?use.\\(stable\\.\\)?\\(force\\|mask\\)\\)\\'" > . conf-mode)) ... which misses package.mask and package.unmask. Added now (in -r1).
Also, we should use conf-space-mode instead of the generic conf-mode. Fixed in -r3.