← Back to team overview

nxhtml team mailing list archive

Re: [Question #223727]: how can I make <? always trigger php-mode

 

Question #223727 on nXhtml changed:
https://answers.launchpad.net/nxhtml/+question/223727

    Status: Open => Solved

tracey jaquith confirmed that the question is solved:
aha!  think i figured out my own answer (the proverbial "one line
change", too, woo).

a bit of a sledgehammer, but essentially never do bad-mode and always
fallback to php-mode after anything like "<?" that isn't "<?xml" is
found...


Index: mumamo-fun.el
===================================================================
--- mumamo-fun.el	(revision 9467)
+++ mumamo-fun.el	(working copy)
@@ -296,41 +296,41 @@
 ;;   "Helper for `mumamo-chunk-xml-pi'.
 ;; POS is where to start search and MIN is where to stop."
 ;;   (mumamo-search-bw-exc-start-xml-pi-1 pos min "<?"))
 
 (defun mumamo-search-fw-exc-start-xml-pi-new (pos max)
   (let ((here (point))
         start
         spec
         exc-mode
         ret)
     (setq start (search-forward "<?" max t))
     (when (and start
                (looking-at (rx (0+ (any "a-z")))))
       (setq spec (match-string-no-properties 0))
       (unless (string= spec "xml")
         (when (= 0 (length spec))
           (setq spec "php"))
         (setq exc-mode (assoc spec mumamo-xml-pi-mode-alist))
         (if exc-mode
             (setq exc-mode (cdr exc-mode))
-          (setq exc-mode 'mumamo-bad-mode))
+          (setq exc-mode 'php-mode))
         (setq ret (list (- start 2) exc-mode nil))))
     (goto-char here)
     ret))
 
 (defun mumamo-xml-pi-end-is-xml-end (pos)
   "Return t if the ?> at pos is end of <?xml."
   (when (> 1000 pos)
 ;;;     (assert (and (= (char-after pos) ??)
 ;;;                  (= (char-after (1+ pos)) ?>)))
     (save-excursion
       (save-restriction
         (widen)
         (save-match-data
           (when (search-backward "<" (- pos 150) t)
             (when (looking-at (rx line-start "<\?xml" (1+ space)))
               (mumamo-msgfntfy "mumamo-xml-pi-end-is-xml-end %s => t" pos)
               t)))))))
 
 ;; (defun mumamo-search-bw-exc-end-xml-pi (pos min)
 ;;   "Helper for `mumamo-chunk-xml-pi'.

-- 
You received this question notification because you are a member of
nXhtml, which is an answer contact for nXhtml.