Function: denote-slug-keep-only-ascii

denote-slug-keep-only-ascii is a byte-compiled function defined in denote.el.

Signature

(denote-slug-keep-only-ascii STR)

Documentation

Remove all non-ASCII characters from STR and replace them with spaces.

This is useful as a helper function to construct denote-file-name-slug-functions.

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
;;;;; Sluggification functions

(defun denote-slug-keep-only-ascii (str)
  "Remove all non-ASCII characters from STR and replace them with spaces.
This is useful as a helper function to construct
`denote-file-name-slug-functions'."
  (let* ((ascii-range (seq-map
                       (lambda (character)
                         (if (and (>= character 33) (<= character 126))
                             character
                           32)) ; empty space
                       str))
         (characters (seq-filter #'characterp ascii-range)))
    (mapconcat #'string characters)))