@example
(defun add-to-list (x list)
- (mapcar (function (lambda (y) (+ x y))) list))
+ (mapcar (lambda (y) (+ x y))) list)
(add-to-list 7 '(1 2 5))
@result{} (8 9 12)
@end example
collect (if flag x (funcall func x))))
(defun add-odd-elements (list x)
- (map-odd-elements (function (lambda (a) (+ a x))) list))
+ (map-odd-elements (lambda (a) (+ a x))) list)
@end example
@noindent
@group
(add-hook 'c-mode-common-hook
- (function (lambda ()
- (c-add-style "my-style" my-c-style t))))
+ (lambda ()
+ (c-add-style "my-style" my-c-style t)))
@end group
@end example
@example
(add-hook 'dired-load-hook
- (function (lambda ()
- (load "dired-x")
- ;; Set dired-x global variables here. For example:
- ;; (setq dired-guess-shell-gnutar "gtar")
- ;; (setq dired-x-hands-off-my-keys nil)
- )))
+ (lambda ()
+ (load "dired-x")
+ ;; Set dired-x global variables here. For example:
+ ;; (setq dired-guess-shell-gnutar "gtar")
+ ;; (setq dired-x-hands-off-my-keys nil)
+ ))
(add-hook 'dired-mode-hook
- (function (lambda ()
- ;; Set dired-x buffer-local variables here. For example:
- ;; (setq dired-omit-files-p t)
- )))
+ (lambda ()
+ ;; Set dired-x buffer-local variables here. For example:
+ ;; (setq dired-omit-files-p t)
+ ))
@end example
@noindent
@example
(add-hook 'dired-load-hook
- (function (lambda ()
- (load "dired-x")
- ;; Bind dired-x-find-file.
- (setq dired-x-hands-off-my-keys nil)
- ;; Make sure our binding preference is invoked.
- (dired-x-bind-find-file)
- )))
+ (lambda ()
+ (load "dired-x")
+ ;; Bind dired-x-find-file.
+ (setq dired-x-hands-off-my-keys nil)
+ ;; Make sure our binding preference is invoked.
+ (dired-x-bind-find-file)
+ ))
@end example
Alternatively, you can set the variable @emph{before} @file{dired-x.el} is
@example
(add-hook 'dired-load-hook
- (function (lambda ()
- ;; Bind dired-x-find-file.
- (setq dired-x-hands-off-my-keys nil)
- (load "dired-x")
- )))
+ (lambda ()
+ ;; Bind dired-x-find-file.
+ (setq dired-x-hands-off-my-keys nil)
+ (load "dired-x")
+ ))
@end example
@node Special Notes, Omitting Files in Dired, Optional Installation File At Point, Installation
@smallexample
(add-hook 'ediff-load-hook
- (function (lambda ()
- (set-face-foreground
- ediff-current-diff-face-B "blue")
- (set-face-background
- ediff-current-diff-face-B "red")
- (make-face-italic
- ediff-current-diff-face-B))))
+ (lambda ()
+ (set-face-foreground
+ ediff-current-diff-face-B "blue")
+ (set-face-background
+ ediff-current-diff-face-B "red")
+ (make-face-italic
+ ediff-current-diff-face-B)))
@end smallexample
@strong{Note:} To set Ediff's faces, use only @code{copy-face} or
(file-error nil))
(add-hook 'XXX-mode-hook
- (function
- (lambda ()
- (setq abbrev-mode t))))
+ (lambda ()
+ (setq abbrev-mode t)))
@end lisp
@node Turning on auto-fill by default, Associating modes with files, Turning on abbrevs by default, Common requests
@lisp
(add-hook 'XXX-mode-hook
- (function
- (lambda ()
- (setq case-fold-search nil))))
+ (lambda ()
+ (setq case-fold-search nil)))
@end lisp
@node Wrapping words automatically, Spell-checkers, Controlling case sensitivity, Common requests
@lisp
(add-hook 'dired-load-hook
- (function (lambda ()
- (load "dired-x"))))
+ (lambda ()
+ (load "dired-x")))
@end lisp
With dired-x loaded, @kbd{M-o} toggles omitting in each dired buffer.
@lisp
(add-hook 'tex-mode-hook
- (function (lambda ()
- (local-set-key (quote [f1]) (quote help-for-help)))))
+ (lambda ()
+ (local-set-key (quote [f1]) (quote help-for-help))))
@end lisp
variable to this "lambda function." For example,
@lisp
-(setq term-setup-hook
- (function
- (lambda ()
- (cond ((string-match "\\`vt220" (or (getenv "TERM") ""))
- ;; Make vt220's "Do" key behave like M-x:
- (global-set-key [do] 'execute-extended-command))
- ))))
+(add-hook 'term-setup-hook
+ (lambda ()
+ (when (string-match "\\`vt220" (or (getenv "TERM") ""))
+ ;; Make vt220's "Do" key behave like M-x:
+ (global-set-key [do] 'execute-extended-command))))
@end lisp
For information on what Emacs does every time it is started, see the
;;; Don't auto-select first article if reading sources, or archives or
;;; jobs postings, etc. and just display the summary buffer
(add-hook 'gnus-select-group-hook
- (function
- (lambda ()
- (cond ((string-match "sources" gnus-newsgroup-name)
- (setq gnus-auto-select-first nil))
- ((string-match "jobs" gnus-newsgroup-name)
- (setq gnus-auto-select-first nil))
- ((string-match "comp\\.archives" gnus-newsgroup-name)
- (setq gnus-auto-select-first nil))
- ((string-match "reviews" gnus-newsgroup-name)
- (setq gnus-auto-select-first nil))
- ((string-match "announce" gnus-newsgroup-name)
- (setq gnus-auto-select-first nil))
- ((string-match "binaries" gnus-newsgroup-name)
- (setq gnus-auto-select-first nil))
- (t
- (setq gnus-auto-select-first t))))))
+ (lambda ()
+ (cond ((string-match "sources" gnus-newsgroup-name)
+ (setq gnus-auto-select-first nil))
+ ((string-match "jobs" gnus-newsgroup-name)
+ (setq gnus-auto-select-first nil))
+ ((string-match "comp\\.archives" gnus-newsgroup-name)
+ (setq gnus-auto-select-first nil))
+ ((string-match "reviews" gnus-newsgroup-name)
+ (setq gnus-auto-select-first nil))
+ ((string-match "announce" gnus-newsgroup-name)
+ (setq gnus-auto-select-first nil))
+ ((string-match "binaries" gnus-newsgroup-name)
+ (setq gnus-auto-select-first nil))
+ (t
+ (setq gnus-auto-select-first t)))))
@end lisp
@item