Function: file-name-sans-versions

file-name-sans-versions is a byte-compiled function defined in files.el.gz.

Signature

(file-name-sans-versions NAME &optional KEEP-BACKUP-VERSION)

Documentation

Return file NAME sans backup versions or strings.

This is a separate procedure so your site-init or startup file can redefine it. If the optional argument KEEP-BACKUP-VERSION is non-nil, we do not remove backup version numbers, only true file version numbers. See file-name-version-regexp for what constitutes backup versions and version strings.

Other relevant functions are documented in the file-name group.

View in manual

Probably introduced at or before Emacs version 18.

Shortdoc

;; file-name
(file-name-sans-versions "/tmp/foo~")
    => "/tmp/foo"

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun file-name-sans-versions (name &optional keep-backup-version)
  "Return file NAME sans backup versions or strings.
This is a separate procedure so your site-init or startup file can
redefine it.
If the optional argument KEEP-BACKUP-VERSION is non-nil,
we do not remove backup version numbers, only true file version numbers.
See `file-name-version-regexp' for what constitutes backup versions
and version strings."
  (let ((handler (find-file-name-handler name 'file-name-sans-versions)))
    (if handler
	(funcall handler 'file-name-sans-versions name keep-backup-version)
      (substring name 0
		 (unless keep-backup-version
                   (string-match (concat file-name-version-regexp "\\'")
                                 name))))))