emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/wdired.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/wdired.el
Date: Wed, 06 Apr 2005 07:57:04 -0400

Index: emacs/lisp/wdired.el
diff -c emacs/lisp/wdired.el:1.7 emacs/lisp/wdired.el:1.8
*** emacs/lisp/wdired.el:1.7    Mon Mar 28 01:25:54 2005
--- emacs/lisp/wdired.el        Wed Apr  6 11:57:03 2005
***************
*** 1,10 ****
  ;;; wdired.el --- Rename files editing their names in dired buffers
  
! ;; Copyright (C) 2001, 2004  Free Software Foundation, Inc.
  
  ;; Filename: wdired.el
! ;; Author: Juan León Lahoz García <address@hidden>
! ;; Version: 1.91
  ;; Keywords: dired, environment, files, renaming
  
  ;; This file is part of GNU Emacs.
--- 1,10 ----
  ;;; wdired.el --- Rename files editing their names in dired buffers
  
! ;; Copyright (C) 2001, 2004, 2005  Free Software Foundation, Inc.
  
  ;; Filename: wdired.el
! ;; Author: Juan León Lahoz García <address@hidden>
! ;; Version: 2.0
  ;; Keywords: dired, environment, files, renaming
  
  ;; This file is part of GNU Emacs.
***************
*** 156,164 ****
  
  ;;; Code:
  
  (eval-when-compile
-   (require 'advice)
-   (defvar dired-backup-overwrite) ; Only in emacs 20.x this is a custom var
    (set (make-local-variable 'byte-compile-dynamic) t))
  
  (eval-and-compile
--- 156,163 ----
  
  ;;; Code:
  
+ (defvar dired-backup-overwrite) ; Only in emacs 20.x this is a custom var
  (eval-when-compile
    (set (make-local-variable 'byte-compile-dynamic) t))
  
  (eval-and-compile
***************
*** 199,217 ****
                 (other :tag "As in dired mode" t))
    :group 'wdired)
  
- (defcustom wdired-advise-functions t
-   "*If t some editing commands are advised when wdired is loaded.
- The advice only has effect in wdired mode.  These commands are
- `query-replace' `query-replace-regexp' `replace-string', and the
- advice makes them to ignore read-only regions, so no attempts to
- modify these regions are done by them, and so they don't end
- prematurely.
- 
- Setting this to nil does not unadvise the functions, if they are
- already advised, but new Emacs will not advise them."
-   :type 'boolean
-   :group 'wdired)
- 
  (defcustom wdired-allow-to-redirect-links t
    "*If non-nil, the target of the symbolic links can be changed also.
  In systems without symbolic links support, this variable has no effect
--- 198,203 ----
***************
*** 309,314 ****
--- 295,301 ----
    (interactive)
    (set (make-local-variable 'wdired-old-content)
         (buffer-substring (point-min) (point-max)))
+   (set (make-local-variable 'query-replace-skip-read-only) t)
    (use-local-map wdired-mode-map)
    (force-mode-line-update)
    (setq buffer-read-only nil)
***************
*** 664,727 ****
    (interactive "p")
    (wdired-xcase-word 'capitalize-word arg))
  
- ;; The following code is related to advice some interactive functions
- ;; to make some editing commands in wdired mode not to fail trying to
- ;; change read-only text. Notice that some advises advice and unadvise
- ;; them-self to another functions: search-forward and
- ;; re-search-forward. This is to keep these functions advised only
- ;; when is necessary. Since they are built-in commands used heavily in
- ;; lots of places, to have it permanently advised would cause some
- ;; performance loss.
- 
- 
- (defun wdired-add-skip-in-replace (command)
-   "Advice COMMAND to skip matches while they have read-only properties.
- This is useful to avoid \"read-only\" errors in search and replace
- commands.  This advice only has effect in wdired mode."
-   (eval
-     `(defadvice ,command (around wdired-discard-read-only activate)
-        ,(format "Make %s to work better with wdired,\n%s."  command
-               "skipping read-only matches when invoked without argument")
-        ad-do-it
-        (if (eq major-mode 'wdired-mode)
-          (while (and ad-return-value
-                      (text-property-any
-                       (max 1 (1- (match-beginning 0))) (match-end 0)
-                       'read-only t))
-            ad-do-it))
-        ad-return-value)))
- 
- 
- (defun wdired-add-replace-advice (command)
-   "Advice COMMAND to skip matches while they have read-only properties.
- This is useful to avoid \"read-only\" errors in search and replace
- commands.  This advice only has effect in wdired mode."
-   (eval
-    `(defadvice ,command (around wdired-grok-read-only activate)
-        ,(format "Make %s to work better with wdired,\n%s."  command
-               "skipping read-only matches when invoked without argument")
-        (if (eq major-mode 'wdired-mode)
-            (progn
-              (wdired-add-skip-in-replace 'search-forward)
-              (wdired-add-skip-in-replace 're-search-forward)
-              (unwind-protect 
-                  ad-do-it
-                (progn
-                  (ad-remove-advice 'search-forward
-                                    'around 'wdired-discard-read-only)
-                  (ad-remove-advice 're-search-forward
-                                    'around 'wdired-discard-read-only)
-                  (ad-update 'search-forward)
-                  (ad-update 're-search-forward))))
-          ad-do-it)
-        ad-return-value)))
- 
- 
- (if wdired-advise-functions
-     (progn
-       (mapcar 'wdired-add-replace-advice
-               '(query-replace query-replace-regexp replace-string))))
- 
  
  ;; The following code deals with changing the access bits (or
  ;; permissions) of the files.
--- 651,656 ----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]