3 ms·
> Markdown doesn't have comment syntax! Sure it does, <!-- ... -->. This is also what Emacs will automatically use if you add-file-local-variable in a Markdown
by throwawayknecht 9y ago
> Markdown doesn't have comment syntax!
Sure it does, <!-- ... -->. This is also what Emacs will automatically use if you add-file-local-variable in a Markdown file, so I don't know why you're using that weird format.
There's a stronger argument to made that org-mode doesn't really have comments. As far as I can tell syntax-ppss never gives me non-nil for them. Sure, a line like "# foo" appears in a comment face, but so does a line like "#+ASDF:" or "#+BEGIN_SRC" (but not a line like "#+TITLE:"). So whether something is a "comment" depends on its contents, which means it's syntax, never really a comment.
- kaushalmodi 9y ago> Sure it does, <!-- ... -->. This is also what Emacs will automatically use if you add-file-local-variable in a Markdown file, so I don't know why you're using that weird format. I was thinking of native comment syntax in Markdown, which is absent. But you are right, HTML comments, like anything else HTML work fine in Markdown. So you have a valid point. > There's a stronger argument to made that org-mode doesn't really have comments. As far as I can tell syntax-ppss never gives me non-nil for them. Hmm, I had never checked that. That's good to know. M-x comment-dwim works though. This might be good to report as Emacs bug. > Sure, a line like "# foo" appears in a comment face, That's a proper comment as per Org spec. Those lines are completely ignored by Org, for any parsing or for any exporting business. > but so does a line like "#+ASDF:" or "#+BEGIN_SRC" (but not a line like "#+TITLE:"). Because those are not comments. It's not an official term but I think of those as pseudo-comments. The "#+.." lines while looking like comments have a special meaning to Org. The meaning of those can also be exporter backend dependent. > So whether something is a "comment" depends on its contents, which means it's syntax, never really a comment. Yes only for #+ comments.
- throwawayknecht 9y ago> M-x comment-dwim works though. This is because org overrides massive amounts of Emacs default functions - in this case, in org-setup-comments-handling. org-mode doesn't really use syntax tables normally. Similar problems occur with strings. They are known issues, and unlikely to be fixed.
- juki 9y ago`#+...` is called "affiliated keyword" in the spec[1]. Those are distinct from comments, which are required to have a whitespace character after the hash sign[2]. [1]: http://orgmode.org/worg/dev/org-syntax.html#Affiliated_keywords http://orgmode.org/worg/dev/org-syntax.html#Affiliated_keywo... [2]: http://orgmode.org/worg/dev/org-syntax.html#Comments http://orgmode.org/worg/dev/org-syntax.html#Comments