# -*- mode: … -*- string fallback

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












So I know that I can put at the first or second line of a file a line such as:



# -*- mode: conf -*-


to tell Emacs what major mode I want the file to be opened with.



But if that mode isn't installed I wish Emacs to fallback to a different mode.
For example I wish to use the apache-mode, but if it doesn't exist I wish to fallback to conf-mode.



Is this possible, and if so how?







share|improve this question


























    up vote
    4
    down vote

    favorite












    So I know that I can put at the first or second line of a file a line such as:



    # -*- mode: conf -*-


    to tell Emacs what major mode I want the file to be opened with.



    But if that mode isn't installed I wish Emacs to fallback to a different mode.
    For example I wish to use the apache-mode, but if it doesn't exist I wish to fallback to conf-mode.



    Is this possible, and if so how?







    share|improve this question
























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      So I know that I can put at the first or second line of a file a line such as:



      # -*- mode: conf -*-


      to tell Emacs what major mode I want the file to be opened with.



      But if that mode isn't installed I wish Emacs to fallback to a different mode.
      For example I wish to use the apache-mode, but if it doesn't exist I wish to fallback to conf-mode.



      Is this possible, and if so how?







      share|improve this question














      So I know that I can put at the first or second line of a file a line such as:



      # -*- mode: conf -*-


      to tell Emacs what major mode I want the file to be opened with.



      But if that mode isn't installed I wish Emacs to fallback to a different mode.
      For example I wish to use the apache-mode, but if it doesn't exist I wish to fallback to conf-mode.



      Is this possible, and if so how?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 22 at 12:12

























      asked Aug 22 at 12:08









      Chen Levy

      20816




      20816




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          8
          down vote













          Found it:



          # -*- mode: conf; mode: apache -*-


          It seems that the last valid mode wins, so I need to put the my wanted mode last, and the fallback mode(s) before it.






          share|improve this answer






















          • Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
            – Harald Hanche-Olsen
            Aug 23 at 8:18










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "583"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f44246%2fmode-string-fallback%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          8
          down vote













          Found it:



          # -*- mode: conf; mode: apache -*-


          It seems that the last valid mode wins, so I need to put the my wanted mode last, and the fallback mode(s) before it.






          share|improve this answer






















          • Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
            – Harald Hanche-Olsen
            Aug 23 at 8:18














          up vote
          8
          down vote













          Found it:



          # -*- mode: conf; mode: apache -*-


          It seems that the last valid mode wins, so I need to put the my wanted mode last, and the fallback mode(s) before it.






          share|improve this answer






















          • Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
            – Harald Hanche-Olsen
            Aug 23 at 8:18












          up vote
          8
          down vote










          up vote
          8
          down vote









          Found it:



          # -*- mode: conf; mode: apache -*-


          It seems that the last valid mode wins, so I need to put the my wanted mode last, and the fallback mode(s) before it.






          share|improve this answer














          Found it:



          # -*- mode: conf; mode: apache -*-


          It seems that the last valid mode wins, so I need to put the my wanted mode last, and the fallback mode(s) before it.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 22 at 12:26

























          answered Aug 22 at 12:08









          Chen Levy

          20816




          20816











          • Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
            – Harald Hanche-Olsen
            Aug 23 at 8:18
















          • Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
            – Harald Hanche-Olsen
            Aug 23 at 8:18















          Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
          – Harald Hanche-Olsen
          Aug 23 at 8:18




          Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though.
          – Harald Hanche-Olsen
          Aug 23 at 8:18

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f44246%2fmode-string-fallback%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery