+2010-10-29 Glenn Morris <rgm@gnu.org>
+
+ * speedbar.el (speedbar-mode):
+ * play/fortune.el (fortune-in-buffer, fortune):
+ * play/gomoku.el (gomoku-mode):
+ * play/landmark.el (lm-mode):
+ * textmodes/bibtex.el (bibtex-validate, bibtex-validate-globally):
+ Replace inappropriate uses of toggle-read-only. (Bug#7292)
+
2010-10-28 Glenn Morris <rgm@gnu.org>
* select.el (x-selection): Mark it as an obsolete alias.
+2010-10-29 Glenn Morris <rgm@gnu.org>
+
+ * mode-local.el (mode-local-augment-function-help):
+ * semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons):
+ * semantic/symref/list.el (semantic-symref-results-dump)
+ (semantic-symref-rb-toggle-expand-tag): Replace inappropriate uses
+ of toggle-read-only.
+
2010-10-12 Juanma Barranquero <lekktu@gmail.com>
* semantic/symref/list.el (semantic-symref-list-rename-open-hits):
;;; mode-local.el --- Support for mode local facilities
;;
-;; Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010
+;; Free Software Foundation, Inc.
;;
;; Author: David Ponce <david@dponce.com>
;; Maintainer: David Ponce <david@dponce.com>
SYMBOL is a function that can be overridden."
(with-current-buffer "*Help*"
(pop-to-buffer (current-buffer))
- (unwind-protect
- (progn
- (toggle-read-only -1)
- (goto-char (point-min))
- (unless (re-search-forward "^$" nil t)
- (goto-char (point-max))
- (beginning-of-line)
- (forward-line -1))
- (insert (overload-docstring-extension symbol) "\n")
- ;; NOTE TO SELF:
- ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
- )
- (toggle-read-only 1))))
+ (goto-char (point-min))
+ (unless (re-search-forward "^$" nil t)
+ (goto-char (point-max))
+ (beginning-of-line)
+ (forward-line -1))
+ (let ((inhibit-read-only t))
+ (insert (overload-docstring-extension symbol) "\n")
+ ;; NOTE TO SELF:
+ ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
+ )))
;; Help for mode-local bindings.
(defun mode-local-print-binding (symbol)
(provide 'mode-local)
-;; arch-tag: 14b77823-f93c-4b3d-9116-495f69a6ec07
;;; mode-local.el ends here
(set-marker orig-buffer (point) (current-buffer))
;; Get a buffer ready.
(with-current-buffer "*Help*"
- (toggle-read-only -1)
- (goto-char (point-min))
- (set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer)
- ;; First, add do-in buttons to recommendations.
- (while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t)
- (let ((fcn (match-string 1)))
- (when (not (fboundp (intern-soft fcn)))
- (error "Help Err: Can't find %s" fcn))
- (end-of-line)
- (insert " ")
- (insert-button "[ Do It ]"
- 'mouse-face 'custom-button-pressed-face
- 'do-fcn fcn
- 'action `(lambda (arg)
- (let ((M semantic-analyzer-debug-orig))
- (set-buffer (marker-buffer M))
- (goto-char M))
- (call-interactively (quote ,(intern-soft fcn))))
- )
- ))
+ (let ((inhibit-read-only t))
+ (goto-char (point-min))
+ (set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer)
+ ;; First, add do-in buttons to recommendations.
+ (while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t)
+ (let ((fcn (match-string 1)))
+ (when (not (fboundp (intern-soft fcn)))
+ (error "Help Err: Can't find %s" fcn))
+ (end-of-line)
+ (insert " ")
+ (insert-button "[ Do It ]"
+ 'mouse-face 'custom-button-pressed-face
+ 'do-fcn fcn
+ 'action `(lambda (arg)
+ (let ((M semantic-analyzer-debug-orig))
+ (set-buffer (marker-buffer M))
+ (goto-char M))
+ (call-interactively (quote ,(intern-soft fcn))))))))
;; Do something else?
-
;; Clean up the mess
- (toggle-read-only 1)
- (set-buffer-modified-p nil)
- )))
+ (set-buffer-modified-p nil))))
(provide 'semantic/analyze/debug)
-;; arch-tag: 943db1e5-47e6-4bec-9989-78ebfadf0358
;;; semantic/analyze/debug.el ends here
(defun semantic-symref-results-dump (results)
"Dump the RESULTS into the current buffer."
;; Get ready for the insert.
- (toggle-read-only -1)
- (erase-buffer)
-
- ;; Insert the contents.
- (let ((lastfile nil)
- )
- (dolist (T (oref results :hit-tags))
-
- (when (not (equal lastfile (semantic-tag-file-name T)))
- (setq lastfile (semantic-tag-file-name T))
- (insert-button lastfile
- 'mouse-face 'custom-button-pressed-face
- 'action 'semantic-symref-rb-goto-file
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ ;; Insert the contents.
+ (let ((lastfile nil))
+ (dolist (T (oref results :hit-tags))
+ (unless (equal lastfile (semantic-tag-file-name T))
+ (setq lastfile (semantic-tag-file-name T))
+ (insert-button lastfile
+ 'mouse-face 'custom-button-pressed-face
+ 'action 'semantic-symref-rb-goto-file
+ 'tag T)
+ (insert "\n"))
+ (insert " ")
+ (insert-button "[+]"
+ 'mouse-face 'highlight
+ 'face nil
+ 'action 'semantic-symref-rb-toggle-expand-tag
'tag T
- )
- (insert "\n"))
-
- (insert " ")
- (insert-button "[+]"
- 'mouse-face 'highlight
- 'face nil
- 'action 'semantic-symref-rb-toggle-expand-tag
- 'tag T
- 'state 'closed)
- (insert " ")
- (insert-button (funcall semantic-symref-results-summary-function
- T nil t)
- 'mouse-face 'custom-button-pressed-face
- 'face nil
- 'action 'semantic-symref-rb-goto-tag
- 'tag T)
- (insert "\n")
-
- ))
-
- ;; Auto expand
- (when semantic-symref-auto-expand-results
- (semantic-symref-list-expand-all))
-
- ;; Clean up the mess
- (toggle-read-only 1)
- (set-buffer-modified-p nil)
- )
+ 'state 'closed)
+ (insert " ")
+ (insert-button (funcall semantic-symref-results-summary-function
+ T nil t)
+ 'mouse-face 'custom-button-pressed-face
+ 'face nil
+ 'action 'semantic-symref-rb-goto-tag
+ 'tag T)
+ (insert "\n")))
+ ;; Auto expand
+ (when semantic-symref-auto-expand-results
+ (semantic-symref-list-expand-all)))
+ ;; Clean up the mess
+ (set-buffer-modified-p nil))
;;; Commands for semantic-symref-results
;;
(buff (semantic-tag-buffer tag))
(hits (semantic--tag-get-property tag :hit))
(state (button-get button 'state))
- (text nil)
- )
+ (text nil))
(cond
((eq state 'closed)
- (toggle-read-only -1)
(with-current-buffer buff
(dolist (H hits)
(goto-char (point-min))
(beginning-of-line)
(back-to-indentation)
(setq text (cons (buffer-substring (point) (point-at-eol)) text)))
- (setq text (nreverse text))
- )
+ (setq text (nreverse text)))
(goto-char (button-start button))
(forward-char 1)
- (delete-char 1)
- (insert "-")
- (button-put button 'state 'open)
- (save-excursion
- (end-of-line)
- (while text
- (insert "\n")
- (insert " ")
- (insert-button (car text)
- 'mouse-face 'highlight
- 'face nil
- 'action 'semantic-symref-rb-goto-match
- 'tag tag
- 'line (car hits))
- (setq text (cdr text)
- hits (cdr hits))))
- (toggle-read-only 1)
- )
+ (let ((inhibit-read-only t))
+ (delete-char 1)
+ (insert "-")
+ (button-put button 'state 'open)
+ (save-excursion
+ (end-of-line)
+ (while text
+ (insert "\n")
+ (insert " ")
+ (insert-button (car text)
+ 'mouse-face 'highlight
+ 'face nil
+ 'action 'semantic-symref-rb-goto-match
+ 'tag tag
+ 'line (car hits))
+ (setq text (cdr text)
+ hits (cdr hits))))))
((eq state 'open)
- (toggle-read-only -1)
- (button-put button 'state 'closed)
- ;; Delete the various bits.
- (goto-char (button-start button))
- (forward-char 1)
- (delete-char 1)
- (insert "+")
- (save-excursion
- (end-of-line)
+ (let ((inhibit-read-only t))
+ (button-put button 'state 'closed)
+ ;; Delete the various bits.
+ (goto-char (button-start button))
(forward-char 1)
- (delete-region (point)
- (save-excursion
- (forward-char 1)
- (forward-line (length hits))
- (point))))
- (toggle-read-only 1)
- )
- ))
- )
+ (delete-char 1)
+ (insert "+")
+ (save-excursion
+ (end-of-line)
+ (forward-char 1)
+ (delete-region (point)
+ (save-excursion
+ (forward-char 1)
+ (forward-line (length hits))
+ (point)))))))))
(defun semantic-symref-rb-goto-file (&optional button)
"Go to the file specified in the symref results buffer.
;; generated-autoload-load-name: "semantic/symref/list"
;; End:
-;; arch-tag: e355d9c6-26e0-42d1-9bf1-f4801a54fffa
;;; semantic/symref/list.el ends here
;;; fortune.el --- use fortune to create signatures
-;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;; 2009, 2010 Free Software Foundation, Inc.
;; Author: Holger Schauer <Holger.Schauer@gmx.de>
;; Keywords: games utils mail
;;; Display fortune
(defun fortune-in-buffer (interactive &optional file)
"Put a fortune cookie in the *fortune* buffer.
-
-INTERACTIVE is ignored. Optional argument FILE,
-when supplied, specifies the file to choose the fortune from."
+INTERACTIVE is ignored. Optional argument FILE, when supplied,
+specifies the file to choose the fortune from."
(let ((fortune-buffer (or (get-buffer fortune-buffer-name)
(generate-new-buffer fortune-buffer-name)))
(fort-file (expand-file-name
(substitute-in-file-name
(or file fortune-file)))))
(with-current-buffer fortune-buffer
- (toggle-read-only 0)
- (erase-buffer)
-
- (if fortune-always-compile
- (fortune-compile fort-file))
-
- (apply 'call-process
- fortune-program ; program to call
- nil fortune-buffer nil ; INFILE BUFFER DISPLAY
- (append (if (stringp fortune-program-options)
- (split-string fortune-program-options)
- fortune-program-options) (list fort-file))))))
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (if fortune-always-compile
+ (fortune-compile fort-file))
+ (apply 'call-process
+ fortune-program ; program to call
+ nil fortune-buffer nil ; INFILE BUFFER DISPLAY
+ (append (if (stringp fortune-program-options)
+ (split-string fortune-program-options)
+ fortune-program-options) (list fort-file)))))))
;;;###autoload
(defun fortune (&optional file)
"Display a fortune cookie.
-
If called with a prefix asks for the FILE to choose the fortune from,
otherwise uses the value of `fortune-file'. If you want to have fortune
choose from a set of files in a directory, call interactively with prefix
and choose the directory as the fortune-file."
- (interactive
- (list
- (if current-prefix-arg
- (fortune-ask-file)
- fortune-file)))
+ (interactive (list (if current-prefix-arg
+ (fortune-ask-file)
+ fortune-file)))
(fortune-in-buffer t file)
(switch-to-buffer (get-buffer fortune-buffer-name))
- (toggle-read-only 1))
+ (setq buffer-read-only t))
;;; Provide ourselves.
(provide 'fortune)
-;; arch-tag: a1e4cb8a-3792-40e7-86a7-fc75ce094bcc
;;; fortune.el ends here
;;; gomoku.el --- Gomoku game between you and Emacs
-;; Copyright (C) 1988, 1994, 1996, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
+;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr>
;; Maintainer: FSF
(gomoku-display-statistics)
(use-local-map gomoku-mode-map)
(make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults '(gomoku-font-lock-keywords t))
- (toggle-read-only t)
+ (setq font-lock-defaults '(gomoku-font-lock-keywords t)
+ buffer-read-only t)
(run-mode-hooks 'gomoku-mode-hook))
\f
;;;
(provide 'gomoku)
-;; arch-tag: b1b8205e-77fc-4597-b373-3ea2c04311eb
;;; gomoku.el ends here
(lm-display-statistics)
(use-local-map lm-mode-map)
(make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults '(lm-font-lock-keywords t))
- (toggle-read-only t)
+ (setq font-lock-defaults '(lm-font-lock-keywords t)
+ buffer-read-only t)
(run-mode-hooks 'lm-mode-hook))
(provide 'landmark)
-;; arch-tag: ae5031be-96e6-459e-a3df-1df53117d3f2
;;; landmark.el ends here
;;; speedbar --- quick access to files and tags in a frame
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008, 2009, 2010
+;; Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: file, tags, tools
(setq font-lock-keywords nil) ;; no font-locking please
(setq truncate-lines t)
(make-local-variable 'frame-title-format)
- (setq frame-title-format (concat "Speedbar " speedbar-version))
- (setq case-fold-search nil)
- (toggle-read-only 1)
+ (setq frame-title-format (concat "Speedbar " speedbar-version)
+ case-fold-search nil
+ buffer-read-only t)
(speedbar-set-mode-line-format)
;; Add in our dframe hooks.
(if speedbar-track-mouse-flag
;; run load-time hooks
(run-hooks 'speedbar-load-hook)
-;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
;;; speedbar ends here
;;; bibtex.el --- BibTeX mode for GNU Emacs
;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
-;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Free Software Foundation, Inc.
;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
;; Bengt Martensson <bengt@mathematik.uni-Bremen.de>
(with-current-buffer (get-buffer-create err-buf)
(setq default-directory dir)
(unless (eq major-mode 'compilation-mode) (compilation-mode))
- (toggle-read-only -1)
- (delete-region (point-min) (point-max))
- (insert "BibTeX mode command `bibtex-validate'\n"
- (if syntax-error
- "Maybe undetected errors due to syntax errors. Correct and validate again.\n"
- "\n"))
- (dolist (err error-list)
- (insert (format "%s:%d: %s\n" file (car err) (cdr err))))
- (set-buffer-modified-p nil)
- (toggle-read-only 1)
+ (let ((inhibit-read-only t))
+ (delete-region (point-min) (point-max))
+ (insert "BibTeX mode command `bibtex-validate'\n"
+ (if syntax-error
+ "Maybe undetected errors due to syntax errors. \
+Correct and validate again.\n"
+ "\n"))
+ (dolist (err error-list)
+ (insert (format "%s:%d: %s\n" file (car err) (cdr err))))
+ (set-buffer-modified-p nil))
(goto-char (point-min))
(forward-line 2)) ; first error message
(display-buffer err-buf)
(let ((err-buf "*BibTeX validation errors*"))
(with-current-buffer (get-buffer-create err-buf)
(unless (eq major-mode 'compilation-mode) (compilation-mode))
- (toggle-read-only -1)
- (delete-region (point-min) (point-max))
- (insert "BibTeX mode command `bibtex-validate-globally'\n\n")
- (dolist (err (sort error-list 'string-lessp)) (insert err))
- (set-buffer-modified-p nil)
- (toggle-read-only 1)
+ (let ((inhibit-read-only t))
+ (delete-region (point-min) (point-max))
+ (insert "BibTeX mode command `bibtex-validate-globally'\n\n")
+ (dolist (err (sort error-list 'string-lessp)) (insert err))
+ (set-buffer-modified-p nil))
(goto-char (point-min))
(forward-line 2)) ; first error message
(display-buffer err-buf)
(provide 'bibtex)
-;; arch-tag: ee2be3af-caad-427f-b42a-d20fad630d04
;;; bibtex.el ends here