#115 [srecord] Error: "There should be a mode declaration in %s"

closed-fixed
nobody
srecode (1)
5
2013-01-15
2013-01-13
No

I open file ~/.srecode/html.srt, same if you open file like
/usr/share/emacs/24.2/etc/srecode/java.srt but you been clean up
srecode-current-map by:

(setq srecode-current-map (srecode-map "SRecode Map"))

and then open file with js-mode and execute M-x srecode-minor-mode.

I got error:

There should be a mode declaration in ...

Debugging shown that:

(defun srecode-map-validate-file-for-mode (file fast)

have code:

(if buff-orig
(set-buffer buff-orig)
(set-buffer (get-buffer-create " *srecode-map-tmp*"))
(insert-file-contents file nil nil nil t)
;; Force it to be ready to parse.
(srecode-template-mode)
(let ((semantic-init-hook nil))
(semantic-new-buffer-fcn))
)

(semantic-fetch-tags)

....

(let* ((mode-tag
(semantic-find-first-tag-by-name "mode" (current-buffer)))

(semantic-fetch-tags) is nil for already opened .srt files because in that
case (semantic-new-buffer-fcn) wasn't called...

So semantic-find-first-tag-by-name fine nothing and this if evaluated to nil:

(if mode-tag
(setq val (car (semantic-tag-variable-default mode-tag)))
(error "There should be a mode declaration in %s" file))

(semantic-new-buffer-fcn) need somehow call in case if user open .srt file and
doesn't enable semantic in this buffer...

Discussion

  • Eric M. Ludlam

    Eric M. Ludlam - 2013-01-15
    • labels: --> srecode
     
  • Eric M. Ludlam

    Eric M. Ludlam - 2013-01-15

    Force semantic-new-buffer-fcn to run while calculating the srecode template map if semantic is not enabled by default.

     
  • Eric M. Ludlam

    Eric M. Ludlam - 2013-01-15
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks