From eb0455abe87ed2e6fd8f0864203bda4e6752cc60 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 17 Dec 2006 18:03:26 +0000 Subject: [PATCH] (magic-mode-alist): Mark as risky. (make-backup-file-name-1): Expand backup-directory explicitly. --- lisp/ChangeLog | 7 +++++++ lisp/files.el | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a5de824ab06..bd8f9b34379 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2006-12-17 Richard Stallman + + * files.el (magic-mode-alist): Mark as risky. + + * files.el (make-backup-file-name-1): + Expand backup-directory explicitly. + 2006-12-17 Michael Albinus * net/tramp.el (tramp-default-method): Before setting to "pscp", diff --git a/lisp/files.el b/lisp/files.el index 141fe9f26c9..6c9b9a7542e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2141,6 +2141,7 @@ to decide the buffer's major mode. If FUNCTION is nil, then it is not called. (That is a way of saying \"allow `auto-mode-alist' to decide for these files.\")") +(put 'magic-mode-alist 'risky-local-variable t) (defvar magic-mode-regexp-match-limit 4000 "Upper limit on `magic-mode-alist' regexp matches.") @@ -3228,6 +3229,12 @@ doesn't exist, it is created." (if (string-match (car elt) file) (setq backup-directory (cdr elt) alist nil))) + ;; If backup-directory is relative, it should be relative to the + ;; file's directory. By expanding explicitly here, we avoid + ;; depending on default-directory. + (if backup-directory + (setq backup-directory (expand-file-name backup-directory + (file-name-directory file)))) (if (and backup-directory (not (file-exists-p backup-directory))) (condition-case nil (make-directory backup-directory 'parents) -- 2.39.2