Subject: bug#9820: 24.0.90; Behaviour of add-file-local-variable

From: Jambunathan K <[email-masked]>
Date: Sat, 22 Oct 2011 10:27:53 +0530

>> Additional note: All other file-local related commands may have to be
>> audited for the requested behaviour.
>
> It displays a message only in `add-file-local-variable' and
> `add-file-local-variable-prop-line'.  I have no opinion
> what other commands might do.

Would you like to give me a new patch with the warning message pushed to
modify-* routines (as Stefan suggested).

This way a (message ...) can be issued as soon as any modifications -
add-or-replace or delete - happen on the buffer.  I think the extra
intelligence of checking for new value against the old value could be
dropped altogether. The message is merely meant as a warning, so being
paranoid and issuing a warning ALWAYS will also serve the purpose well.

> === modified file 'lisp/files-x.el'
> --- lisp/files-x.el	2011-04-19 13:44:55 +0000
> +++ lisp/files-x.el	2011-10-21 14:04:22 +0000
> @@ -214,7 +214,11 @@ (defun add-file-local-variable (variable
>    (interactive
>     (let ((variable (read-file-local-variable "Add file-local variable")))
>       (list variable (read-file-local-variable-value variable))))
> -  (modify-file-local-variable variable value 'add-or-replace))
> +  (modify-file-local-variable variable value 'add-or-replace)
> +  (when (and (called-interactively-p 'interactive)
> +	     (symbolp variable) (boundp variable)
> +	     (not (equal (symbol-value variable) value)))
> +    (message "Revisit file to make this change take effect")))
>  
>  ;;;###autoload
>  (defun delete-file-local-variable (variable)
> @@ -335,7 +339,11 @@ (defun add-file-local-variable-prop-line
>    (interactive
>     (let ((variable (read-file-local-variable "Add -*- file-local variable")))
>       (list variable (read-file-local-variable-value variable))))
> -  (modify-file-local-variable-prop-line variable value 'add-or-replace))
> +  (modify-file-local-variable-prop-line variable value 'add-or-replace)
> +  (when (and (called-interactively-p 'interactive)
> +	     (symbolp variable) (boundp variable)
> +	     (not (equal (symbol-value variable) value)))
> +    (message "Revisit file to make this change take effect")))
>  
>  ;;;###autoload
>  (defun delete-file-local-variable-prop-line (variable)