Groups | Search | Server Info | Login | Register


Groups > gnu.emacs.help > #60969

Re: Help required with regexp in auto-mode-alist

From steve <sgonedes1977@gmail.com>
Newsgroups gnu.emacs.help
Subject Re: Help required with regexp in auto-mode-alist
References <87ttt2uhl3.fsf@zedat.fu-berlin.de>
Date 2024-04-19 17:57 -0400
Message-ID <87r0f19ft3.fsf@gmail.com> (permalink)
Organization 

Show all headers | View raw


"Loris Bennett" <loris.bennett@fu-berlin.de> writes:

< Hi,

< I edit pages of a wiki (FOSWiki), which, when opened in Emacs via the
< Firefox extension "Edit with Emacs", end up in buffers with names like
< the following:
>
<   wiki.zedat.fu-berlin.de/bin/edit/SCS/ScsProtokoll20230816?t=1692000848;nowysiwyg=1
>
< I would like to associate these with a specific mode and therefore have
>
<   (add-to-list 'auto-mode-alist '("wiki\\.zedat\\.fu-berlin\\.de/bin/edit/SCS/.*" . erin-mode))



Your regexp is probably off. auto-mode-alist is a regexp for the type of
file. that would be everything after the `.'

i just downloaded the extension and it works great. Try and run M-x
server-start first.

from my emacs file:


;; .emacs.el


;; start emacs server mode
(server-start)

;; append paths to auto-mode-alist
;; check for duplicates with rassoc
(unless (rassoc 'html-mode auto-mode-alist)
  (setq auto-mode-alist
	    (append auto-mode-alist
			    '(("\\.txt\\'" . rst-mode)
                  ("\\.html?\\'" . html-mode)
				  ("\\.rest\\'" . rst-mode)
				  ("\\.md\\'"   . rst-mode)
				  ("^README.*"   . rst-mode)
				  ("\\.\\(pp\\|dpr\\|dpk\\|inc\\)\\'" . pascal-mode)
				  ("\\.fpc\\'" . makefile-gmake-mode)
				  ("\\.cl\\'" . lisp-mode )
				  ("\\.asd\\'"  . lisp-mode)))))

;; hook function to modify html-mode
(defun si::html-mode-hook ()
  "Function to run when new HTML buffer is created."
  (setq sgml-basic-offset 2)
  (message "Editing a HTML file: %s" (buffer-file-name (current-buffer))))


(add-hook 'html-mode-hook 'si::html-mode-hook)

< in my setup.  However, the mode is not selected.  What is wrong with my
< regexp?


the regexp should be looking for *.html$ that means ending with .html.

hope this helps

Back to gnu.emacs.help | Previous | NextPrevious in thread | Find similar


Thread

Help required with regexp in auto-mode-alist "Loris Bennett" <loris.bennett@fu-berlin.de> - 2023-08-14 10:57 +0200
  Re: Help required with regexp in auto-mode-alist steve <sgonedes1977@gmail.com> - 2024-04-19 17:57 -0400

csiph-web