• Help required with regexp in auto-mode-alist

    From Loris Bennett@loris.bennett@fu-berlin.de to gnu.emacs.help on Mon Aug 14 10:57:28 2023
    From Newsgroup: gnu.emacs.help

    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))

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

    Cheers,

    Loris
    --
    --
    This signature is currently under constuction.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From steve@sgonedes1977@gmail.com to gnu.emacs.help on Fri Apr 19 17:57:12 2024
    From Newsgroup: gnu.emacs.help

    "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
    --- Synchronet 3.21d-Linux NewsLink 1.2