Timothy <tecos...@gmail.com> writes: > See attached for a patch which just adds this face. I feel like this might be > the final version of this patch so I’d appreciate thoughts on this.
I have some comments. See below. > (org-inline-src-fontify-max-length): Create a variable to limit the > maximum length of an inline-src block fontified, to protect from lag > spikes (e.g. when typing out src_lang{ and half of the buffer is > fontified). I do not like this. Even with this variable, some part of buffer may be spuriously fontified. Maybe you just verify that you are at actual inline-src block by examining org-element-context? > +(defun org-fontify-inline-src-blocks (limit) > + "Try to apply `org-fontify-inline-src-blocks-1'." > + (condition-case nil > + (progn > + (org-fontify-inline-src-blocks-1 limit) > + (org-fontify-inline-src-results limit)) org-fontify-inline-src-results is not defined in this patch. > + (font-lock-append-text-property lang-beg lang-end 'face > 'org-meta-line) > + (font-lock-append-text-property beg lang-beg 'face 'shadow) > + (font-lock-append-text-property beg lang-end 'face > 'org-inline-src-block) Is there some special reason why you apply both 'shadow and 'org-inline-src-block? What about 'org-meta-line face? Maybe 'org-meta-line should not be hard-coded? > + (setq pt (goto-char lang-end)) > + ;; `org-element--parse-paired-brackets' doesn't take a limit, so to > + ;; prevent it searching the entire rest of the buffer we temporarily > + ;; narrow the active region. > + (save-restriction > + (narrow-to-region beg (min (point-max) > + limit > + (+ lang-end > org-inline-src-fontify-max-length))) > + (when (ignore-errors (org-element--parse-paired-brackets ?\[)) > + (font-lock-append-text-property pt (point) 'face > 'org-inline-src-block) > + (setq pt (point))) > + (when (ignore-errors (org-element--parse-paired-brackets ?\{)) It looks like you are repeating the job of org-element-context here. Why don't you just get the proper object? > + (remove-text-properties pt (point) '(face nil)) > + (font-lock-append-text-property pt (1+ pt) 'face '(org-block > shadow)) Do you really intend to use 'org-block and 'shadow faces here? Not 'org-inline-src-block? > +(defcustom org-inline-src-prettify-results t Looks like a stray defcustom. At least, it is not mentioned in the commit message and not used within the patch. Best, Ihor