{"action":"created","issue":{"url":"https://api.github.com/repos/clojure-emacs/clojure-mode/issues/445","repository_url":"https://api.github.com/repos/clojure-emacs/clojure-mode","labels_url":"https://api.github.com/repos/clojure-emacs/clojure-mode/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/clojure-emacs/clojure-mode/issues/445/comments","events_url":"https://api.github.com/repos/clojure-emacs/clojure-mode/issues/445/events","html_url":"https://github.com/clojure-emacs/clojure-mode/issues/445","id":259056945,"number":445,"title":"(def s \"a string\") font locks \"a string\" as a docstring","user":{"login":"oskarkv","id":861064,"avatar_url":"https://avatars2.githubusercontent.com/u/861064?v=4","gravatar_id":"","url":"https://api.github.com/users/oskarkv","html_url":"https://github.com/oskarkv","followers_url":"https://api.github.com/users/oskarkv/followers","following_url":"https://api.github.com/users/oskarkv/following{/other_user}","gists_url":"https://api.github.com/users/oskarkv/gists{/gist_id}","starred_url":"https://api.github.com/users/oskarkv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oskarkv/subscriptions","organizations_url":"https://api.github.com/users/oskarkv/orgs","repos_url":"https://api.github.com/users/oskarkv/repos","events_url":"https://api.github.com/users/oskarkv/events{/privacy}","received_events_url":"https://api.github.com/users/oskarkv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-20T06:47:20Z","updated_at":"2017-10-30T13:44:09Z","closed_at":null,"author_association":"NONE","body":"## Expected behavior\r\n\r\nFont lock the string `\"a string\"` as a string in `(def s \"a string\")`.\r\n\r\n## Actual behavior\r\n\r\nThe string `\"a string\"` is font locked as a docstring in `(def s \"a string\")`.\r\n\r\n## clojure-mode version information\r\n```\r\nclojure-mode (version 5.7.0-snapshot)\r\n```\r\n\r\n## Proposed solution\r\n\r\nI played around with this, and it can be solved by adding a check in this `and` https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L898 in the function `clojure-font-lock-syntactic-face-function`. For example\r\n```\r\n(and ...\r\n  (or (save-excursion\r\n        (goto-char startpos)\r\n        (not (= ?\\) (char-after (+ startpos (length (sexp-at-point)) 2)))))\r\n      (string= \"defprotocol\" firstsym)))\r\n```\r\n\r\nThis, of course, checks for a closing paren after the string, and if so, it is not considered a docstring, except for `defprotocol`, which is the only kind of form that can have a docstring in the last position. Instead of checking for a paren, one could of course check for another element, but it is more involved.\r\n\r\nOpinions, suggestions, etc?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/clojure-emacs/clojure-mode/issues/comments/340447580","html_url":"https://github.com/clojure-emacs/clojure-mode/issues/445#issuecomment-340447580","issue_url":"https://api.github.com/repos/clojure-emacs/clojure-mode/issues/445","id":340447580,"user":{"login":"Macroz","id":823661,"avatar_url":"https://avatars1.githubusercontent.com/u/823661?v=4","gravatar_id":"","url":"https://api.github.com/users/Macroz","html_url":"https://github.com/Macroz","followers_url":"https://api.github.com/users/Macroz/followers","following_url":"https://api.github.com/users/Macroz/following{/other_user}","gists_url":"https://api.github.com/users/Macroz/gists{/gist_id}","starred_url":"https://api.github.com/users/Macroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Macroz/subscriptions","organizations_url":"https://api.github.com/users/Macroz/orgs","repos_url":"https://api.github.com/users/Macroz/repos","events_url":"https://api.github.com/users/Macroz/events{/privacy}","received_events_url":"https://api.github.com/users/Macroz/received_events","type":"User","site_admin":false},"created_at":"2017-10-30T13:44:09Z","updated_at":"2017-10-30T13:44:09Z","author_association":"NONE","body":"Your proposed fix works for me."}}
{"actor":{"display_login":"Macroz"}}