Skip to content

Instantly share code, notes, and snippets.

@Anks
Created September 9, 2014 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anks/ef43f2f0f1153f0fbeac to your computer and use it in GitHub Desktop.
Save Anks/ef43f2f0f1153f0fbeac to your computer and use it in GitHub Desktop.
deft-mode – Strip file variables from title line
;; Customise deft to remove file-vars from the title line.
;;
;; I use 'markdown-mode with deft usually, but for some longform files,
;; I prefer using 'org-mode.
;;
;; The easiest way to do this is to use a file variable like so:
;;
;; -*- mode: org; -*-
;;
;; in the first line of the file. This makes the file open in 'org-mode
;; instead of 'markdown-mode.
;;
;; Unfortunately, this ugly variable line will be shown in the main
;; deft frame. This function solves that problem.
(defun deft-title-fn-strip-file-vars (str)
(replace-regexp-in-string "-\\*-.*-\\*-" "" (deft-strip-title str)))
(setq deft-parse-title-function 'deft-title-fn-strip-file-vars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment