Mercurial > emacs
comparison lisp/files.el @ 90780:ec58e5c426ef
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 653-661)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 203-206)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-180
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 04 Mar 2007 06:19:40 +0000 |
parents | dd7c098af727 ec75921d5b7b |
children | 91bf6e05918b |
comparison
equal
deleted
inserted
replaced
90779:6ea6d3d1508d | 90780:ec58e5c426ef |
---|---|
2283 (defun set-auto-mode-0 (mode &optional keep-mode-if-same) | 2283 (defun set-auto-mode-0 (mode &optional keep-mode-if-same) |
2284 "Apply MODE and return it. | 2284 "Apply MODE and return it. |
2285 If optional arg KEEP-MODE-IF-SAME is non-nil, MODE is chased of | 2285 If optional arg KEEP-MODE-IF-SAME is non-nil, MODE is chased of |
2286 any aliases and compared to current major mode. If they are the | 2286 any aliases and compared to current major mode. If they are the |
2287 same, do nothing and return nil." | 2287 same, do nothing and return nil." |
2288 (when keep-mode-if-same | 2288 (unless (and keep-mode-if-same |
2289 (while (symbolp (symbol-function mode)) | 2289 (eq (indirect-function mode) |
2290 (setq mode (symbol-function mode))) | 2290 (indirect-function major-mode))) |
2291 (if (eq mode major-mode) | 2291 (when mode |
2292 (setq mode nil))) | 2292 (funcall mode) |
2293 (when mode | 2293 mode))) |
2294 (funcall mode) | |
2295 mode)) | |
2296 | 2294 |
2297 (defun set-auto-mode-1 () | 2295 (defun set-auto-mode-1 () |
2298 "Find the -*- spec in the buffer. | 2296 "Find the -*- spec in the buffer. |
2299 Call with point at the place to start searching from. | 2297 Call with point at the place to start searching from. |
2300 If one is found, set point to the beginning | 2298 If one is found, set point to the beginning |
2809 (if (funcall function exp) | 2807 (if (funcall function exp) |
2810 (setq ok t))) | 2808 (setq ok t))) |
2811 ok))))))) | 2809 ok))))))) |
2812 | 2810 |
2813 (defun hack-one-local-variable (var val) | 2811 (defun hack-one-local-variable (var val) |
2814 "Set local variable VAR with value VAL." | 2812 "Set local variable VAR with value VAL. |
2813 If VAR is `mode', call `VAL-mode' as a function unless it's | |
2814 already the major mode." | |
2815 (cond ((eq var 'mode) | 2815 (cond ((eq var 'mode) |
2816 (funcall (intern (concat (downcase (symbol-name val)) "-mode")))) | 2816 (let ((mode (intern (concat (downcase (symbol-name val)) |
2817 "-mode")))) | |
2818 (unless (eq (indirect-function mode) | |
2819 (indirect-function major-mode)) | |
2820 (funcall mode)))) | |
2817 ((eq var 'eval) | 2821 ((eq var 'eval) |
2818 (save-excursion (eval val))) | 2822 (save-excursion (eval val))) |
2819 (t | 2823 (t |
2820 ;; Make sure the string has no text properties. | 2824 ;; Make sure the string has no text properties. |
2821 ;; Some text properties can get evaluated in various ways, | 2825 ;; Some text properties can get evaluated in various ways, |