Mercurial > emacs
comparison lisp/play/fortune.el @ 111257:516f3d80dac6
Replace some inappropriate uses of toggle-read-only. (Bug#7292)
* lisp/speedbar.el (speedbar-mode):
* lisp/play/fortune.el (fortune-in-buffer, fortune):
* lisp/play/gomoku.el (gomoku-mode):
* lisp/play/landmark.el (lm-mode):
* lisp/textmodes/bibtex.el (bibtex-validate, bibtex-validate-globally):
* lisp/cedet/mode-local.el (mode-local-augment-function-help):
* lisp/semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons):
* lisp/semantic/symref/list.el (semantic-symref-results-dump)
(semantic-symref-rb-toggle-expand-tag):
Replace inappropriate uses of toggle-read-only.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 29 Oct 2010 00:48:10 -0700 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
comparison
equal
deleted
inserted
replaced
111256:d3a53e95c036 | 111257:516f3d80dac6 |
---|---|
1 ;;; fortune.el --- use fortune to create signatures | 1 ;;; fortune.el --- use fortune to create signatures |
2 | 2 |
3 ;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, | 3 ;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
4 ;; 2008, 2009, 2010 Free Software Foundation, Inc. | 4 ;; 2009, 2010 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Holger Schauer <Holger.Schauer@gmx.de> | 6 ;; Author: Holger Schauer <Holger.Schauer@gmx.de> |
7 ;; Keywords: games utils mail | 7 ;; Keywords: games utils mail |
8 | 8 |
9 ;; This file is part of GNU Emacs. | 9 ;; This file is part of GNU Emacs. |
283 | 283 |
284 ;;; ************** | 284 ;;; ************** |
285 ;;; Display fortune | 285 ;;; Display fortune |
286 (defun fortune-in-buffer (interactive &optional file) | 286 (defun fortune-in-buffer (interactive &optional file) |
287 "Put a fortune cookie in the *fortune* buffer. | 287 "Put a fortune cookie in the *fortune* buffer. |
288 | 288 INTERACTIVE is ignored. Optional argument FILE, when supplied, |
289 INTERACTIVE is ignored. Optional argument FILE, | 289 specifies the file to choose the fortune from." |
290 when supplied, specifies the file to choose the fortune from." | |
291 (let ((fortune-buffer (or (get-buffer fortune-buffer-name) | 290 (let ((fortune-buffer (or (get-buffer fortune-buffer-name) |
292 (generate-new-buffer fortune-buffer-name))) | 291 (generate-new-buffer fortune-buffer-name))) |
293 (fort-file (expand-file-name | 292 (fort-file (expand-file-name |
294 (substitute-in-file-name | 293 (substitute-in-file-name |
295 (or file fortune-file))))) | 294 (or file fortune-file))))) |
296 (with-current-buffer fortune-buffer | 295 (with-current-buffer fortune-buffer |
297 (toggle-read-only 0) | 296 (let ((inhibit-read-only t)) |
298 (erase-buffer) | 297 (erase-buffer) |
299 | 298 (if fortune-always-compile |
300 (if fortune-always-compile | 299 (fortune-compile fort-file)) |
301 (fortune-compile fort-file)) | 300 (apply 'call-process |
302 | 301 fortune-program ; program to call |
303 (apply 'call-process | 302 nil fortune-buffer nil ; INFILE BUFFER DISPLAY |
304 fortune-program ; program to call | 303 (append (if (stringp fortune-program-options) |
305 nil fortune-buffer nil ; INFILE BUFFER DISPLAY | 304 (split-string fortune-program-options) |
306 (append (if (stringp fortune-program-options) | 305 fortune-program-options) (list fort-file))))))) |
307 (split-string fortune-program-options) | |
308 fortune-program-options) (list fort-file)))))) | |
309 | 306 |
310 ;;;###autoload | 307 ;;;###autoload |
311 (defun fortune (&optional file) | 308 (defun fortune (&optional file) |
312 "Display a fortune cookie. | 309 "Display a fortune cookie. |
313 | |
314 If called with a prefix asks for the FILE to choose the fortune from, | 310 If called with a prefix asks for the FILE to choose the fortune from, |
315 otherwise uses the value of `fortune-file'. If you want to have fortune | 311 otherwise uses the value of `fortune-file'. If you want to have fortune |
316 choose from a set of files in a directory, call interactively with prefix | 312 choose from a set of files in a directory, call interactively with prefix |
317 and choose the directory as the fortune-file." | 313 and choose the directory as the fortune-file." |
318 (interactive | 314 (interactive (list (if current-prefix-arg |
319 (list | 315 (fortune-ask-file) |
320 (if current-prefix-arg | 316 fortune-file))) |
321 (fortune-ask-file) | |
322 fortune-file))) | |
323 (fortune-in-buffer t file) | 317 (fortune-in-buffer t file) |
324 (switch-to-buffer (get-buffer fortune-buffer-name)) | 318 (switch-to-buffer (get-buffer fortune-buffer-name)) |
325 (toggle-read-only 1)) | 319 (setq buffer-read-only t)) |
326 | 320 |
327 | 321 |
328 ;;; Provide ourselves. | 322 ;;; Provide ourselves. |
329 (provide 'fortune) | 323 (provide 'fortune) |
330 | 324 |
331 ;; arch-tag: a1e4cb8a-3792-40e7-86a7-fc75ce094bcc | |
332 ;;; fortune.el ends here | 325 ;;; fortune.el ends here |