* desktop.el and minor modes
@ 2004-05-30 20:11 Juri Linkov
2004-05-31 10:20 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-05-30 20:11 UTC (permalink / raw)
Cc: Lars Hansen
desktop.el saves variable names to the minor-modes slot of
`desktop-create-buffer', but those variables can't be funcalled
when desktop is restored.
I noticed this problem when desktop.el saved in the desktop file
variables `dired-omit-files-p' for all buffers. This is useless.
Perhaps `desktop-save' should check if a symbol from
`minor-mode-alist' is a function in case if there is no corresponding
variable-to-function mapping in `desktop-minor-mode-table'?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-30 20:11 Juri Linkov
@ 2004-05-31 10:20 ` Lars Hansen
2004-05-31 13:16 ` Lars Hansen
2004-05-31 13:52 ` Juri Linkov
0 siblings, 2 replies; 26+ messages in thread
From: Lars Hansen @ 2004-05-31 10:20 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>desktop.el saves variable names to the minor-modes slot of
>`desktop-create-buffer', but those variables can't be funcalled
>when desktop is restored.
>
The conventions for minor modes is that the same symbol should be used
for the mode variable as for the enabling function.
Those minor modes having a different name for the toggling function,
should have be listed in desktop-minor-modes-table.
>Perhaps `desktop-save' should check if a symbol from
>`minor-mode-alist' is a function in case if there is no corresponding
>variable-to-function mapping in `desktop-minor-mode-table'?
>
When desktop restores a buffer, it checks if there is a function
definition for each symbol in desktop-buffer-minor-modes before calling it.
I don't see why doing this check at desktop-save should be better.
The problem with dired-omit-files-p is that it does not follow the
conventions.
Rather than hacking desktop to work around this, I think dired-x should
be changed.
The result is much cleaner.
I suggest something like:
1. Rename variable dired-omit-files-p to dired-omit-mode
2. Replace function dired-omit-toggle with functions
- dired-omit-mode following the convention for the argument
- dired-mark-omit marking files to omit
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 10:20 ` Lars Hansen
@ 2004-05-31 13:16 ` Lars Hansen
2004-05-31 13:52 ` Juri Linkov
2004-05-31 13:52 ` Juri Linkov
1 sibling, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-05-31 13:16 UTC (permalink / raw)
Cc: Juri Linkov
I wrote:
> The problem with dired-omit-files-p is that it does not follow the
> conventions.
> Rather than hacking desktop to work around this, I think dired-x
> should be changed.
> The result is much cleaner.
>
> I suggest something like:
> 1. Rename variable dired-omit-files-p to dired-omit-mode
> 2. Replace function dired-omit-toggle with functions
> - dired-omit-mode following the convention for the argument
> - dired-mark-omit marking files to omit
I am ready with a patch. Any objections that I install it?
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 10:20 ` Lars Hansen
2004-05-31 13:16 ` Lars Hansen
@ 2004-05-31 13:52 ` Juri Linkov
2004-05-31 21:48 ` Lars Hansen
1 sibling, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-05-31 13:52 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> When desktop restores a buffer, it checks if there is a function
> definition for each symbol in desktop-buffer-minor-modes before
> calling it.
> I don't see why doing this check at desktop-save should be better.
desktop-save could check if a symbol is a function to not write to
the desktop file useless variable names that later can't be called
as functions when desktop is restored.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 13:16 ` Lars Hansen
@ 2004-05-31 13:52 ` Juri Linkov
2004-05-31 16:38 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-05-31 13:52 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
>> The problem with dired-omit-files-p is that it does not follow the
>> conventions.
>> Rather than hacking desktop to work around this, I think dired-x
>> should be changed.
>> The result is much cleaner.
>>
>> I suggest something like:
>> 1. Rename variable dired-omit-files-p to dired-omit-mode
>> 2. Replace function dired-omit-toggle with functions
>> - dired-omit-mode following the convention for the argument
>> - dired-mark-omit marking files to omit
>
> I am ready with a patch. Any objections that I install it?
Could you show a patch before installing it? I doubt that your
solution will be backward compatible.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 13:52 ` Juri Linkov
@ 2004-05-31 16:38 ` Lars Hansen
2004-05-31 19:26 ` Miles Bader
0 siblings, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-05-31 16:38 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>Could you show a patch before installing it? I doubt that your
>solution will be backward compatible.
>
The patch is shown below.
The dired-omit-files-p is kept as variable alias for backwards
compatibility.
Function dired-omit-toggle has been replaced by functions
dired-omit-mode and dired-mark-omitted. Clearly that is not backwards
compatible. If that is a problem, we can simply keep dired-omit-toggle
and remove dired-mark-omitted. IMHO it is a bit confusing to have
dired-omit-mode as well as dired-omit-toggle, that's why I removed
dired-omit-toggle. But I don't have a strong opinion on that.
diff -u -r1.54 dired-x.el
--- lisp/dired-x.el 31 Mar 2004 16:09:18 -0000 1.54
+++ lisp/dired-x.el 31 May 2004 16:26:51 -0000
@@ -50,7 +50,7 @@
;; (add-hook 'dired-mode-hook
;; (function (lambda ()
;; ;; Set buffer-local variables here. For example:
-;; ;; (setq dired-omit-files-p t)
+;; ;; (dired-omit-mode 1)
;; )))
;;
;; At load time dired-x.el will install itself, redefine some
functions, and
@@ -74,7 +74,7 @@
;; dired-guess-shell-znew-switches
;; dired-guess-shell-alist-user
;; dired-clean-up-buffers-too
-;; dired-omit-files-p
+;; dired-omit-mode
;; dired-omit-files
;; dired-omit-extensions
;; dired-omit-size-limit
@@ -154,19 +154,23 @@
(other :tag "non-writable only" if-file-read-only))
:group 'dired-x)
-(defcustom dired-omit-files-p nil
+(defcustom dired-omit-mode nil
"*If non-nil, \"uninteresting\" files are not listed (buffer-local).
-Use \\[dired-omit-toggle] to toggle its value.
+Use \\[dired-omit-mode] to toggle its value.
Uninteresting files are those whose filenames match regexp
`dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'."
:type 'boolean
:group 'dired-x)
-(make-variable-buffer-local 'dired-omit-files-p)
+(make-variable-buffer-local 'dired-omit-mode)
+
+;; Maintained for backward compatibility
+(defvaralias 'dired-omit-files-p 'dired-omit-mode)
+(make-obsolete-variable 'dired-omit-files-p 'dired-omit-mode)
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
"*Filenames matching this regexp will not be displayed.
-This only has effect when `dired-omit-files-p' is t. See interactive
function
-`dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable
+This only has effect when `dired-omit-mode' is t. See interactive function
+`dired-omit-mode' \(\\[dired-omit-mode]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
files and lock files."
:type 'regexp
@@ -230,7 +234,7 @@
;;; KEY BINDINGS.
-(define-key dired-mode-map "\M-o" 'dired-omit-toggle)
+(define-key dired-mode-map "\M-o" 'dired-omit-mode)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
@@ -268,7 +272,7 @@
\\[dired-info]\t-- run info on file
\\[dired-man]\t-- run man on file
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
- \\[dired-omit-toggle]\t-- toggle omitting of files
+ \\[dired-omit-mode]\t-- toggle omitting of files
\\[dired-mark-sexp]\t-- mark by Lisp expression
\\[dired-copy-filename-as-kill]\t-- copy the file or subdir names
into the kill ring.
\t You can feed it to other commands using \\[yank].
@@ -280,7 +284,7 @@
`dired-bind-info'
`dired-bind-man'
`dired-vm-read-only-folders'
- `dired-omit-files-p'
+ `dired-omit-mode'
`dired-omit-files'
`dired-omit-extensions'
`dired-omit-size-limit'
@@ -450,9 +454,9 @@
(dired-insert-subdir (file-name-directory file))
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
- (if dired-omit-files-p
+ (if dired-omit-mode
(progn
- (dired-omit-toggle)
+ (dired-omit-mode)
(dired-goto-file file))))))))
(defun dired-jump-other-window ()
@@ -479,31 +483,34 @@
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
- (or (assq 'dired-omit-files-p minor-mode-alist)
+ (or (assq 'dired-omit-mode minor-mode-alist)
(setq minor-mode-alist
- (append '((dired-omit-files-p
+ (append '((dired-omit-mode
(:eval (if (eq major-mode 'dired-mode)
" Omit" ""))))
minor-mode-alist))))
-(defun dired-omit-toggle (&optional flag)
- "Toggle omitting files matching `dired-omit-files' and
`dired-omit-extensions'.
-With an arg, and if omitting was off, don't toggle and just mark the
- files but don't actually omit them.
-With an arg, and if omitting was on, turn it off but don't refresh the
buffer."
+(defun dired-omit-mode (&optional arg)
+ "Toggle Dired Omit Mode.
+With numeric ARG, turn Dired Omit Mode on if ARG is positive, off
otherwise.
+
+In Dired Omit Mode, files matching `dired-omit-files' and
`dired-omit-extensions'
+are omitted."
(interactive "P")
- (if flag
- (if dired-omit-files-p
- (setq dired-omit-files-p (not dired-omit-files-p))
- (dired-mark-unmarked-files (dired-omit-regexp) nil nil
- dired-omit-localp))
- ;; no FLAG
- (setq dired-omit-files-p (not dired-omit-files-p))
- (if (not dired-omit-files-p)
- (revert-buffer)
- ;; this will mention how many were omitted:
- (let ((dired-omit-size-limit nil))
- (dired-omit-expunge)))))
+ (setq dired-omit-mode
+ (if (null arg) (not dired-omit-mode) (> (prefix-numeric-value
arg) 0)))
+ (if dired-omit-mode
+ ;; This will mention how many lines were omitted:
+ (let ((dired-omit-size-limit nil)) (dired-omit-expunge))
+ (revert-buffer)
+ (message "Omit Mode disabled"))
+ (force-mode-line-update))
+
+(defun dired-mark-omitted ()
+ "Mark files matching `dired-omit-files' and `dired-omit-extensions'."
+ (interactive)
+ (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
+ (dired-mark-unmarked-files (dired-omit-regexp) nil nil
dired-omit-localp))
(defvar dired-omit-extensions
(append completion-ignored-extensions
@@ -515,12 +522,12 @@
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
`dired-texinfo-unclean-extensions'.
-See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and
-variables `dired-omit-files-p' and `dired-omit-files'.")
+See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
+variables `dired-omit-mode' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
-Does nothing if global variable `dired-omit-files-p' is nil, or if called
+Does nothing if global variable `dired-omit-mode' is nil, or if called
non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
@@ -529,14 +536,14 @@
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
- (if (and dired-omit-files-p
+ (if (and dired-omit-mode
(or (interactive-p)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(message "Not omitting: directory larger than %d characters."
dired-omit-size-limit)
- (setq dired-omit-files-p nil)
+ (setq dired-omit-mode nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
@@ -589,7 +596,7 @@
(defun dired-omit-new-add-entry (filename &optional marker-char relative)
;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
;; files that are going to be omitted anyway.
- (if dired-omit-files-p
+ (if dired-omit-mode
;; perhaps return t without calling ls
(let ((omit-re (dired-omit-regexp)))
(if (or (string= omit-re "")
@@ -842,7 +849,7 @@
(save-excursion
(set-buffer (get-buffer-create " *dot-dired*"))
(erase-buffer)
- (insert "Local Variables:\ndired-omit-files-p: t\nEnd:\n")
+ (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n")
(write-file dired-local-variables-file)
(kill-buffer (current-buffer)))
@@ -1692,7 +1699,7 @@
'dired-guess-shell-znew-switches
'dired-guess-shell-alist-user
'dired-clean-up-buffers-too
- 'dired-omit-files-p
+ 'dired-omit-mode
'dired-omit-files
'dired-omit-extensions
)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 16:38 ` Lars Hansen
@ 2004-05-31 19:26 ` Miles Bader
2004-05-31 21:22 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Miles Bader @ 2004-05-31 19:26 UTC (permalink / raw)
Cc: Juri Linkov, emacs-devel
On Mon, May 31, 2004 at 06:38:22PM +0200, Lars Hansen wrote:
> Function dired-omit-toggle has been replaced by functions
> dired-omit-mode and dired-mark-omitted.
You really ought to use `define-minor-mode' rather than rolling your own
minor-mode function.
Thanks,
-Miles
--
A zen-buddhist walked into a pizza shop and
said, "Make me one with everything."
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 19:26 ` Miles Bader
@ 2004-05-31 21:22 ` Lars Hansen
0 siblings, 0 replies; 26+ messages in thread
From: Lars Hansen @ 2004-05-31 21:22 UTC (permalink / raw)
Cc: Juri Linkov, emacs-devel
Miles Bader wrote:
>You really ought to use `define-minor-mode' rather than rolling your own
>minor-mode function.
>
Right. What about this:
diff -u -r1.54 dired-x.el
--- lisp/dired-x.el 31 Mar 2004 16:09:18 -0000 1.54
+++ lisp/dired-x.el 31 May 2004 21:18:15 -0000
@@ -50,7 +50,7 @@
;; (add-hook 'dired-mode-hook
;; (function (lambda ()
;; ;; Set buffer-local variables here. For example:
-;; ;; (setq dired-omit-files-p t)
+;; ;; (dired-omit-mode 1)
;; )))
;;
;; At load time dired-x.el will install itself, redefine some
functions, and
@@ -74,7 +74,7 @@
;; dired-guess-shell-znew-switches
;; dired-guess-shell-alist-user
;; dired-clean-up-buffers-too
-;; dired-omit-files-p
+;; dired-omit-mode
;; dired-omit-files
;; dired-omit-extensions
;; dired-omit-size-limit
@@ -154,19 +154,27 @@
(other :tag "non-writable only" if-file-read-only))
:group 'dired-x)
-(defcustom dired-omit-files-p nil
- "*If non-nil, \"uninteresting\" files are not listed (buffer-local).
-Use \\[dired-omit-toggle] to toggle its value.
+(define-minor-mode dired-omit-mode
+ "Toggle Dired-Omit mode.
+With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
+otherwise. Enabling and disabling is buffer-local.
+If enabled, \"uninteresting\" files are not listed.
Uninteresting files are those whose filenames match regexp
`dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'."
- :type 'boolean
- :group 'dired-x)
-(make-variable-buffer-local 'dired-omit-files-p)
+ :group 'dired-x
+ (if dired-omit-mode
+ ;; This will mention how many lines were omitted:
+ (let ((dired-omit-size-limit nil)) (dired-omit-expunge))
+ (revert-buffer)))
+
+;; For backward compatibility
+(defvaralias 'dired-omit-files-p 'dired-omit-mode)
+(make-obsolete-variable 'dired-omit-files-p 'dired-omit-mode)
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
"*Filenames matching this regexp will not be displayed.
-This only has effect when `dired-omit-files-p' is t. See interactive
function
-`dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable
+This only has effect when `dired-omit-mode' is t. See interactive function
+`dired-omit-mode' \(\\[dired-omit-mode]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
files and lock files."
:type 'regexp
@@ -230,7 +238,7 @@
;;; KEY BINDINGS.
-(define-key dired-mode-map "\M-o" 'dired-omit-toggle)
+(define-key dired-mode-map "\M-o" 'dired-omit-mode)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
@@ -268,7 +276,7 @@
\\[dired-info]\t-- run info on file
\\[dired-man]\t-- run man on file
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
- \\[dired-omit-toggle]\t-- toggle omitting of files
+ \\[dired-omit-mode]\t-- toggle omitting of files
\\[dired-mark-sexp]\t-- mark by Lisp expression
\\[dired-copy-filename-as-kill]\t-- copy the file or subdir names
into the kill ring.
\t You can feed it to other commands using \\[yank].
@@ -280,7 +288,7 @@
`dired-bind-info'
`dired-bind-man'
`dired-vm-read-only-folders'
- `dired-omit-files-p'
+ `dired-omit-mode'
`dired-omit-files'
`dired-omit-extensions'
`dired-omit-size-limit'
@@ -450,9 +458,9 @@
(dired-insert-subdir (file-name-directory file))
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
- (if dired-omit-files-p
+ (if dired-omit-mode
(progn
- (dired-omit-toggle)
+ (dired-omit-mode)
(dired-goto-file file))))))))
(defun dired-jump-other-window ()
@@ -479,31 +487,18 @@
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
- (or (assq 'dired-omit-files-p minor-mode-alist)
+ (or (assq 'dired-omit-mode minor-mode-alist)
(setq minor-mode-alist
- (append '((dired-omit-files-p
+ (append '((dired-omit-mode
(:eval (if (eq major-mode 'dired-mode)
" Omit" ""))))
minor-mode-alist))))
-(defun dired-omit-toggle (&optional flag)
- "Toggle omitting files matching `dired-omit-files' and
`dired-omit-extensions'.
-With an arg, and if omitting was off, don't toggle and just mark the
- files but don't actually omit them.
-With an arg, and if omitting was on, turn it off but don't refresh the
buffer."
- (interactive "P")
- (if flag
- (if dired-omit-files-p
- (setq dired-omit-files-p (not dired-omit-files-p))
- (dired-mark-unmarked-files (dired-omit-regexp) nil nil
- dired-omit-localp))
- ;; no FLAG
- (setq dired-omit-files-p (not dired-omit-files-p))
- (if (not dired-omit-files-p)
- (revert-buffer)
- ;; this will mention how many were omitted:
- (let ((dired-omit-size-limit nil))
- (dired-omit-expunge)))))
+(defun dired-mark-omitted ()
+ "Mark files matching `dired-omit-files' and `dired-omit-extensions'."
+ (interactive)
+ (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
+ (dired-mark-unmarked-files (dired-omit-regexp) nil nil
dired-omit-localp))
(defvar dired-omit-extensions
(append completion-ignored-extensions
@@ -515,12 +510,12 @@
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
`dired-texinfo-unclean-extensions'.
-See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and
-variables `dired-omit-files-p' and `dired-omit-files'.")
+See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
+variables `dired-omit-mode' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
-Does nothing if global variable `dired-omit-files-p' is nil, or if called
+Does nothing if global variable `dired-omit-mode' is nil, or if called
non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
@@ -529,14 +524,14 @@
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
- (if (and dired-omit-files-p
+ (if (and dired-omit-mode
(or (interactive-p)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(message "Not omitting: directory larger than %d characters."
dired-omit-size-limit)
- (setq dired-omit-files-p nil)
+ (setq dired-omit-mode nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
@@ -589,7 +584,7 @@
(defun dired-omit-new-add-entry (filename &optional marker-char relative)
;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
;; files that are going to be omitted anyway.
- (if dired-omit-files-p
+ (if dired-omit-mode
;; perhaps return t without calling ls
(let ((omit-re (dired-omit-regexp)))
(if (or (string= omit-re "")
@@ -842,7 +837,7 @@
(save-excursion
(set-buffer (get-buffer-create " *dot-dired*"))
(erase-buffer)
- (insert "Local Variables:\ndired-omit-files-p: t\nEnd:\n")
+ (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n")
(write-file dired-local-variables-file)
(kill-buffer (current-buffer)))
@@ -1692,7 +1687,7 @@
'dired-guess-shell-znew-switches
'dired-guess-shell-alist-user
'dired-clean-up-buffers-too
- 'dired-omit-files-p
+ 'dired-omit-mode
'dired-omit-files
'dired-omit-extensions
)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-05-31 13:52 ` Juri Linkov
@ 2004-05-31 21:48 ` Lars Hansen
[not found] ` <87vfici4md.fsf@mail.jurta.org>
0 siblings, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-05-31 21:48 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>desktop-save could check if a symbol is a function to not write to
>the desktop file useless variable names that later can't be called
>as functions when desktop is restored.
>
>
That makes sense. I have comitted a change that does that.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
[not found] ` <87vfici4md.fsf@mail.jurta.org>
@ 2004-06-01 6:22 ` Lars Hansen
2004-06-01 16:34 ` Juri Linkov
0 siblings, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-06-01 6:22 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>But I can't test your changes to dired-x.el because both patches you
>sent to emacs-devel are broken. Could you send me a correct patch?
>
I try again:
lh@lhcybercom:~/cvsroot/emacs/lisp$ diff -c dired-x.el.~1.54.~ dired-x.el
*** dired-x.el.~1.54.~ Wed Mar 31 18:09:18 2004
--- dired-x.el Mon May 31 23:16:25 2004
***************
*** 50,56 ****
;; (add-hook 'dired-mode-hook
;; (function (lambda ()
;; ;; Set buffer-local variables here. For example:
! ;; ;; (setq dired-omit-files-p t)
;; )))
;;
;; At load time dired-x.el will install itself, redefine some
functions, and
--- 50,56 ----
;; (add-hook 'dired-mode-hook
;; (function (lambda ()
;; ;; Set buffer-local variables here. For example:
! ;; ;; (dired-omit-mode 1)
;; )))
;;
;; At load time dired-x.el will install itself, redefine some
functions, and
***************
*** 74,80 ****
;; dired-guess-shell-znew-switches
;; dired-guess-shell-alist-user
;; dired-clean-up-buffers-too
! ;; dired-omit-files-p
;; dired-omit-files
;; dired-omit-extensions
;; dired-omit-size-limit
--- 74,80 ----
;; dired-guess-shell-znew-switches
;; dired-guess-shell-alist-user
;; dired-clean-up-buffers-too
! ;; dired-omit-mode
;; dired-omit-files
;; dired-omit-extensions
;; dired-omit-size-limit
***************
*** 154,172 ****
(other :tag "non-writable only" if-file-read-only))
:group 'dired-x)
! (defcustom dired-omit-files-p nil
! "*If non-nil, \"uninteresting\" files are not listed (buffer-local).
! Use \\[dired-omit-toggle] to toggle its value.
Uninteresting files are those whose filenames match regexp
`dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'."
! :type 'boolean
! :group 'dired-x)
! (make-variable-buffer-local 'dired-omit-files-p)
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
"*Filenames matching this regexp will not be displayed.
! This only has effect when `dired-omit-files-p' is t. See interactive
function
! `dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
files and lock files."
:type 'regexp
--- 154,180 ----
(other :tag "non-writable only" if-file-read-only))
:group 'dired-x)
! (define-minor-mode dired-omit-mode
! "Toggle Dired-Omit mode.
! With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
! otherwise. Enabling and disabling is buffer-local.
! If enabled, \"uninteresting\" files are not listed.
Uninteresting files are those whose filenames match regexp
`dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'."
! :group 'dired-x
! (if dired-omit-mode
! ;; This will mention how many lines were omitted:
! (let ((dired-omit-size-limit nil)) (dired-omit-expunge))
! (revert-buffer)))
!
! ;; For backward compatibility
! (defvaralias 'dired-omit-files-p 'dired-omit-mode)
! (make-obsolete-variable 'dired-omit-files-p 'dired-omit-mode)
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
"*Filenames matching this regexp will not be displayed.
! This only has effect when `dired-omit-mode' is t. See interactive
function
! `dired-omit-mode' \(\\[dired-omit-mode]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
files and lock files."
:type 'regexp
***************
*** 230,236 ****
;;; KEY BINDINGS.
! (define-key dired-mode-map "\M-o" 'dired-omit-toggle)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
--- 238,244 ----
;;; KEY BINDINGS.
! (define-key dired-mode-map "\M-o" 'dired-omit-mode)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
***************
*** 268,274 ****
\\[dired-info]\t-- run info on file
\\[dired-man]\t-- run man on file
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
! \\[dired-omit-toggle]\t-- toggle omitting of files
\\[dired-mark-sexp]\t-- mark by Lisp expression
\\[dired-copy-filename-as-kill]\t-- copy the file or subdir names
into the kill ring.
\t You can feed it to other commands using \\[yank].
--- 276,282 ----
\\[dired-info]\t-- run info on file
\\[dired-man]\t-- run man on file
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
! \\[dired-omit-mode]\t-- toggle omitting of files
\\[dired-mark-sexp]\t-- mark by Lisp expression
\\[dired-copy-filename-as-kill]\t-- copy the file or subdir names
into the kill ring.
\t You can feed it to other commands using \\[yank].
***************
*** 280,286 ****
`dired-bind-info'
`dired-bind-man'
`dired-vm-read-only-folders'
! `dired-omit-files-p'
`dired-omit-files'
`dired-omit-extensions'
`dired-omit-size-limit'
--- 288,294 ----
`dired-bind-info'
`dired-bind-man'
`dired-vm-read-only-folders'
! `dired-omit-mode'
`dired-omit-files'
`dired-omit-extensions'
`dired-omit-size-limit'
***************
*** 450,458 ****
(dired-insert-subdir (file-name-directory file))
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
! (if dired-omit-files-p
(progn
! (dired-omit-toggle)
(dired-goto-file file))))))))
(defun dired-jump-other-window ()
--- 458,466 ----
(dired-insert-subdir (file-name-directory file))
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
! (if dired-omit-mode
(progn
! (dired-omit-mode)
(dired-goto-file file))))))))
(defun dired-jump-other-window ()
***************
*** 479,509 ****
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
! (or (assq 'dired-omit-files-p minor-mode-alist)
(setq minor-mode-alist
! (append '((dired-omit-files-p
(:eval (if (eq major-mode 'dired-mode)
" Omit" ""))))
minor-mode-alist))))
! (defun dired-omit-toggle (&optional flag)
! "Toggle omitting files matching `dired-omit-files' and
`dired-omit-extensions'.
! With an arg, and if omitting was off, don't toggle and just mark the
! files but don't actually omit them.
! With an arg, and if omitting was on, turn it off but don't refresh the
buffer."
! (interactive "P")
! (if flag
! (if dired-omit-files-p
! (setq dired-omit-files-p (not dired-omit-files-p))
! (dired-mark-unmarked-files (dired-omit-regexp) nil nil
! dired-omit-localp))
! ;; no FLAG
! (setq dired-omit-files-p (not dired-omit-files-p))
! (if (not dired-omit-files-p)
! (revert-buffer)
! ;; this will mention how many were omitted:
! (let ((dired-omit-size-limit nil))
! (dired-omit-expunge)))))
(defvar dired-omit-extensions
(append completion-ignored-extensions
--- 487,504 ----
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
! (or (assq 'dired-omit-mode minor-mode-alist)
(setq minor-mode-alist
! (append '((dired-omit-mode
(:eval (if (eq major-mode 'dired-mode)
" Omit" ""))))
minor-mode-alist))))
! (defun dired-mark-omitted ()
! "Mark files matching `dired-omit-files' and `dired-omit-extensions'."
! (interactive)
! (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
! (dired-mark-unmarked-files (dired-omit-regexp) nil nil
dired-omit-localp))
(defvar dired-omit-extensions
(append completion-ignored-extensions
***************
*** 515,526 ****
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
`dired-texinfo-unclean-extensions'.
! See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and
! variables `dired-omit-files-p' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
! Does nothing if global variable `dired-omit-files-p' is nil, or if called
non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
--- 510,521 ----
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
`dired-texinfo-unclean-extensions'.
! See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
! variables `dired-omit-mode' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
! Does nothing if global variable `dired-omit-mode' is nil, or if called
non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
***************
*** 529,542 ****
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
! (if (and dired-omit-files-p
(or (interactive-p)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(message "Not omitting: directory larger than %d
characters."
dired-omit-size-limit)
! (setq dired-omit-files-p nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
--- 524,537 ----
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
! (if (and dired-omit-mode
(or (interactive-p)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(message "Not omitting: directory larger than %d
characters."
dired-omit-size-limit)
! (setq dired-omit-mode nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
***************
*** 589,595 ****
(defun dired-omit-new-add-entry (filename &optional marker-char relative)
;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
;; files that are going to be omitted anyway.
! (if dired-omit-files-p
;; perhaps return t without calling ls
(let ((omit-re (dired-omit-regexp)))
(if (or (string= omit-re "")
--- 584,590 ----
(defun dired-omit-new-add-entry (filename &optional marker-char relative)
;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
;; files that are going to be omitted anyway.
! (if dired-omit-mode
;; perhaps return t without calling ls
(let ((omit-re (dired-omit-regexp)))
(if (or (string= omit-re "")
***************
*** 842,848 ****
(save-excursion
(set-buffer (get-buffer-create " *dot-dired*"))
(erase-buffer)
! (insert "Local Variables:\ndired-omit-files-p: t\nEnd:\n")
(write-file dired-local-variables-file)
(kill-buffer (current-buffer)))
--- 837,843 ----
(save-excursion
(set-buffer (get-buffer-create " *dot-dired*"))
(erase-buffer)
! (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n")
(write-file dired-local-variables-file)
(kill-buffer (current-buffer)))
***************
*** 1692,1698 ****
'dired-guess-shell-znew-switches
'dired-guess-shell-alist-user
'dired-clean-up-buffers-too
! 'dired-omit-files-p
'dired-omit-files
'dired-omit-extensions
)
--- 1687,1693 ----
'dired-guess-shell-znew-switches
'dired-guess-shell-alist-user
'dired-clean-up-buffers-too
! 'dired-omit-mode
'dired-omit-files
'dired-omit-extensions
)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-01 6:22 ` Lars Hansen
@ 2004-06-01 16:34 ` Juri Linkov
2004-06-02 5:50 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-06-01 16:34 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> I try again
Your MUA breaks patches by refilling lines in them. Please send
patches as attachments (or use an Emacs-based MUA :-)
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-01 16:34 ` Juri Linkov
@ 2004-06-02 5:50 ` Lars Hansen
2004-06-05 1:05 ` Juri Linkov
0 siblings, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-06-02 5:50 UTC (permalink / raw)
Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
Juri Linkov wrote:
>Your MUA breaks patches by refilling lines in them. Please send
>patches as attachments (or use an Emacs-based MUA :-)
>
>
Ok, so that's what "broken" means. I try with an attatchment.
Sorry for spamming the list with broken patches.
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 12525 bytes --]
lh@lhcybercom:~/cvsroot/emacs/lisp$ diff -c dired-x.el.~1.54.~ dired-x.el
*** dired-x.el.~1.54.~ Wed Mar 31 18:09:18 2004
--- dired-x.el Mon May 31 23:16:25 2004
***************
*** 50,56 ****
;; (add-hook 'dired-mode-hook
;; (function (lambda ()
;; ;; Set buffer-local variables here. For example:
! ;; ;; (setq dired-omit-files-p t)
;; )))
;;
;; At load time dired-x.el will install itself, redefine some functions, and
--- 50,56 ----
;; (add-hook 'dired-mode-hook
;; (function (lambda ()
;; ;; Set buffer-local variables here. For example:
! ;; ;; (dired-omit-mode 1)
;; )))
;;
;; At load time dired-x.el will install itself, redefine some functions, and
***************
*** 74,80 ****
;; dired-guess-shell-znew-switches
;; dired-guess-shell-alist-user
;; dired-clean-up-buffers-too
! ;; dired-omit-files-p
;; dired-omit-files
;; dired-omit-extensions
;; dired-omit-size-limit
--- 74,80 ----
;; dired-guess-shell-znew-switches
;; dired-guess-shell-alist-user
;; dired-clean-up-buffers-too
! ;; dired-omit-mode
;; dired-omit-files
;; dired-omit-extensions
;; dired-omit-size-limit
***************
*** 154,172 ****
(other :tag "non-writable only" if-file-read-only))
:group 'dired-x)
! (defcustom dired-omit-files-p nil
! "*If non-nil, \"uninteresting\" files are not listed (buffer-local).
! Use \\[dired-omit-toggle] to toggle its value.
Uninteresting files are those whose filenames match regexp `dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'."
! :type 'boolean
! :group 'dired-x)
! (make-variable-buffer-local 'dired-omit-files-p)
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
"*Filenames matching this regexp will not be displayed.
! This only has effect when `dired-omit-files-p' is t. See interactive function
! `dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
files and lock files."
:type 'regexp
--- 154,180 ----
(other :tag "non-writable only" if-file-read-only))
:group 'dired-x)
! (define-minor-mode dired-omit-mode
! "Toggle Dired-Omit mode.
! With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
! otherwise. Enabling and disabling is buffer-local.
! If enabled, \"uninteresting\" files are not listed.
Uninteresting files are those whose filenames match regexp `dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'."
! :group 'dired-x
! (if dired-omit-mode
! ;; This will mention how many lines were omitted:
! (let ((dired-omit-size-limit nil)) (dired-omit-expunge))
! (revert-buffer)))
!
! ;; For backward compatibility
! (defvaralias 'dired-omit-files-p 'dired-omit-mode)
! (make-obsolete-variable 'dired-omit-files-p 'dired-omit-mode)
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
"*Filenames matching this regexp will not be displayed.
! This only has effect when `dired-omit-mode' is t. See interactive function
! `dired-omit-mode' \(\\[dired-omit-mode]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
files and lock files."
:type 'regexp
***************
*** 230,236 ****
;;; KEY BINDINGS.
! (define-key dired-mode-map "\M-o" 'dired-omit-toggle)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
--- 238,244 ----
;;; KEY BINDINGS.
! (define-key dired-mode-map "\M-o" 'dired-omit-mode)
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
(define-key dired-mode-map "*(" 'dired-mark-sexp)
(define-key dired-mode-map "*." 'dired-mark-extension)
***************
*** 268,274 ****
\\[dired-info]\t-- run info on file
\\[dired-man]\t-- run man on file
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
! \\[dired-omit-toggle]\t-- toggle omitting of files
\\[dired-mark-sexp]\t-- mark by Lisp expression
\\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring.
\t You can feed it to other commands using \\[yank].
--- 276,282 ----
\\[dired-info]\t-- run info on file
\\[dired-man]\t-- run man on file
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
! \\[dired-omit-mode]\t-- toggle omitting of files
\\[dired-mark-sexp]\t-- mark by Lisp expression
\\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring.
\t You can feed it to other commands using \\[yank].
***************
*** 280,286 ****
`dired-bind-info'
`dired-bind-man'
`dired-vm-read-only-folders'
! `dired-omit-files-p'
`dired-omit-files'
`dired-omit-extensions'
`dired-omit-size-limit'
--- 288,294 ----
`dired-bind-info'
`dired-bind-man'
`dired-vm-read-only-folders'
! `dired-omit-mode'
`dired-omit-files'
`dired-omit-extensions'
`dired-omit-size-limit'
***************
*** 450,458 ****
(dired-insert-subdir (file-name-directory file))
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
! (if dired-omit-files-p
(progn
! (dired-omit-toggle)
(dired-goto-file file))))))))
(defun dired-jump-other-window ()
--- 458,466 ----
(dired-insert-subdir (file-name-directory file))
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
! (if dired-omit-mode
(progn
! (dired-omit-mode)
(dired-goto-file file))))))))
(defun dired-jump-other-window ()
***************
*** 479,509 ****
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
! (or (assq 'dired-omit-files-p minor-mode-alist)
(setq minor-mode-alist
! (append '((dired-omit-files-p
(:eval (if (eq major-mode 'dired-mode)
" Omit" ""))))
minor-mode-alist))))
! (defun dired-omit-toggle (&optional flag)
! "Toggle omitting files matching `dired-omit-files' and `dired-omit-extensions'.
! With an arg, and if omitting was off, don't toggle and just mark the
! files but don't actually omit them.
! With an arg, and if omitting was on, turn it off but don't refresh the buffer."
! (interactive "P")
! (if flag
! (if dired-omit-files-p
! (setq dired-omit-files-p (not dired-omit-files-p))
! (dired-mark-unmarked-files (dired-omit-regexp) nil nil
! dired-omit-localp))
! ;; no FLAG
! (setq dired-omit-files-p (not dired-omit-files-p))
! (if (not dired-omit-files-p)
! (revert-buffer)
! ;; this will mention how many were omitted:
! (let ((dired-omit-size-limit nil))
! (dired-omit-expunge)))))
(defvar dired-omit-extensions
(append completion-ignored-extensions
--- 487,504 ----
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
! (or (assq 'dired-omit-mode minor-mode-alist)
(setq minor-mode-alist
! (append '((dired-omit-mode
(:eval (if (eq major-mode 'dired-mode)
" Omit" ""))))
minor-mode-alist))))
! (defun dired-mark-omitted ()
! "Mark files matching `dired-omit-files' and `dired-omit-extensions'."
! (interactive)
! (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
! (dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp))
(defvar dired-omit-extensions
(append completion-ignored-extensions
***************
*** 515,526 ****
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
`dired-texinfo-unclean-extensions'.
! See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and
! variables `dired-omit-files-p' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
! Does nothing if global variable `dired-omit-files-p' is nil, or if called
non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
--- 510,521 ----
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
`dired-texinfo-unclean-extensions'.
! See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
! variables `dired-omit-mode' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
! Does nothing if global variable `dired-omit-mode' is nil, or if called
non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
***************
*** 529,542 ****
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
! (if (and dired-omit-files-p
(or (interactive-p)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(message "Not omitting: directory larger than %d characters."
dired-omit-size-limit)
! (setq dired-omit-files-p nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
--- 524,537 ----
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
! (if (and dired-omit-mode
(or (interactive-p)
(not dired-omit-size-limit)
(< (buffer-size) dired-omit-size-limit)
(progn
(message "Not omitting: directory larger than %d characters."
dired-omit-size-limit)
! (setq dired-omit-mode nil)
nil)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
***************
*** 589,595 ****
(defun dired-omit-new-add-entry (filename &optional marker-char relative)
;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
;; files that are going to be omitted anyway.
! (if dired-omit-files-p
;; perhaps return t without calling ls
(let ((omit-re (dired-omit-regexp)))
(if (or (string= omit-re "")
--- 584,590 ----
(defun dired-omit-new-add-entry (filename &optional marker-char relative)
;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
;; files that are going to be omitted anyway.
! (if dired-omit-mode
;; perhaps return t without calling ls
(let ((omit-re (dired-omit-regexp)))
(if (or (string= omit-re "")
***************
*** 842,848 ****
(save-excursion
(set-buffer (get-buffer-create " *dot-dired*"))
(erase-buffer)
! (insert "Local Variables:\ndired-omit-files-p: t\nEnd:\n")
(write-file dired-local-variables-file)
(kill-buffer (current-buffer)))
--- 837,843 ----
(save-excursion
(set-buffer (get-buffer-create " *dot-dired*"))
(erase-buffer)
! (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n")
(write-file dired-local-variables-file)
(kill-buffer (current-buffer)))
***************
*** 1692,1698 ****
'dired-guess-shell-znew-switches
'dired-guess-shell-alist-user
'dired-clean-up-buffers-too
! 'dired-omit-files-p
'dired-omit-files
'dired-omit-extensions
)
--- 1687,1693 ----
'dired-guess-shell-znew-switches
'dired-guess-shell-alist-user
'dired-clean-up-buffers-too
! 'dired-omit-mode
'dired-omit-files
'dired-omit-extensions
)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-02 5:50 ` Lars Hansen
@ 2004-06-05 1:05 ` Juri Linkov
0 siblings, 0 replies; 26+ messages in thread
From: Juri Linkov @ 2004-06-05 1:05 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> Juri Linkov wrote:
>>Your MUA breaks patches by refilling lines in them. Please send
>>patches as attachments (or use an Emacs-based MUA :-)
>
> Ok, so that's what "broken" means. I try with an attatchment.
> Sorry for spamming the list with broken patches.
Unfortunately, this patch is still broken, because now your MUA
replaced all tabs with spaces even in the attachment!
>From your mail headers I see that you sent it with Mozilla. I must say
that it is a pile of crap (I mean its email client, not the web browser).
Dump it and start using REAL (i.e. Emacs-based) mail agents.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
@ 2004-06-05 17:59 Lars Hansen
2004-06-05 18:03 ` David Kastrup
` (2 more replies)
0 siblings, 3 replies; 26+ messages in thread
From: Lars Hansen @ 2004-06-05 17:59 UTC (permalink / raw)
Cc: emacs-devel
>
>
>Unfortunately, this patch is still broken, because now your MUA
>replaced all tabs with spaces even in the attachment!
>
Come on, Mozilla didn't do that! And did that really stop you from
trying my patch?
Anyway, I just installed it (modified to bind dired-mark-omitted to M-O)
together with and update of dired-x.texi.
>From your mail headers I see that you sent it with Mozilla. I must say
>that it is a pile of crap (I mean its email client, not the web browser).
>Dump it and start using REAL (i.e. Emacs-based) mail agents.
>
I used Emacs as MUA a couple of years ago, but I was annoyed by its
unability to handle MTML formatted mail.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-05 17:59 desktop.el and minor modes Lars Hansen
@ 2004-06-05 18:03 ` David Kastrup
2004-06-05 18:14 ` Lars Hansen
2004-06-05 18:47 ` Juri Linkov
2004-06-07 8:09 ` Juri Linkov
2 siblings, 1 reply; 26+ messages in thread
From: David Kastrup @ 2004-06-05 18:03 UTC (permalink / raw)
Cc: Juri Linkov, emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> >Unfortunately, this patch is still broken, because now your MUA
> >replaced all tabs with spaces even in the attachment!
> >
> Come on, Mozilla didn't do that! And did that really stop you from
> trying my patch?
> Anyway, I just installed it (modified to bind dired-mark-omitted to
> M-O) together with and update of dired-x.texi.
>
> >From your mail headers I see that you sent it with Mozilla. I must say
> >that it is a pile of crap (I mean its email client, not the web browser).
> >Dump it and start using REAL (i.e. Emacs-based) mail agents.
> >
> I used Emacs as MUA a couple of years ago, but I was annoyed by its
> unability to handle MTML formatted mail.
MTML? Uh, what?
Anyway, gnus handles my mail (including attachments and stuff) quite
well.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-05 18:03 ` David Kastrup
@ 2004-06-05 18:14 ` Lars Hansen
0 siblings, 0 replies; 26+ messages in thread
From: Lars Hansen @ 2004-06-05 18:14 UTC (permalink / raw)
Cc: Juri Linkov, emacs-devel
David Kastrup wrote:
>MTML? Uh, what?
>
>
HTML :-) (my finges seem to hit the wrong keys and my eyes not see the
result).
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-05 17:59 desktop.el and minor modes Lars Hansen
2004-06-05 18:03 ` David Kastrup
@ 2004-06-05 18:47 ` Juri Linkov
2004-06-07 8:09 ` Juri Linkov
2 siblings, 0 replies; 26+ messages in thread
From: Juri Linkov @ 2004-06-05 18:47 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
>>Unfortunately, this patch is still broken, because now your MUA
>>replaced all tabs with spaces even in the attachment!
>>
> Come on, Mozilla didn't do that! And did that really stop you from
> trying my patch?
`ediff-patch-file' failed to apply it. And I didn't want to fiddle
with this problem too much trying different options etc., because
I suspected that since the patch is not in its original from, I may
run into other problems.
> Anyway, I just installed it (modified to bind dired-mark-omitted to
> M-O) together with and update of dired-x.texi.
OK. I will try it from CVS.
>>From your mail headers I see that you sent it with Mozilla. I must say
>>that it is a pile of crap (I mean its email client, not the web browser).
>>Dump it and start using REAL (i.e. Emacs-based) mail agents.
>>
> I used Emacs as MUA a couple of years ago, but I was annoyed by its
> unability to handle MTML formatted mail.
Does MTML mean Mangled Text Markup Language? ;-) Anyway, I think
HTML email is a bad thing. But Gnus still can handle it pretty well
with w3m package.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-05 17:59 desktop.el and minor modes Lars Hansen
2004-06-05 18:03 ` David Kastrup
2004-06-05 18:47 ` Juri Linkov
@ 2004-06-07 8:09 ` Juri Linkov
2004-06-08 6:49 ` Lars Hansen
2004-06-08 20:32 ` Richard Stallman
2 siblings, 2 replies; 26+ messages in thread
From: Juri Linkov @ 2004-06-07 8:09 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> Anyway, I just installed it (modified to bind dired-mark-omitted to
> M-O) together with and update of dired-x.texi.
I tried your changes, and `dired-omit-mode' works well, as expected.
Thanks.
However, this change is not backward compatible. I can't tell how serious
this problem is, but users who have the old variable `dired-omit-files-p'
customized in their .emacs may discover that it doesn't work anymore.
The reason is that old `dired-omit-files-p' was a global variable
defined by defcustom, but `dired-omit-mode' is a minor mode defined
without `:global t' argument.
One solution is to add `:global t' to make `dired-omit-mode'
customizable (`define-minor-mode' interprets `:global t' by defining
it by `defcustom'). But this requires adding a special call to
`make-variable-buffer-local' to make customizable `dired-omit-mode'
buffer-local that may cause problems for desktop.el where the variable
`dired-omit-mode' will be saved for all buffers.
So until a good solution is found, you can simply write an
appropriate entry to etc/NEWS with explanations that instead of
customizing `dired-omit-files-p' users should write a call to
`dired-omit-mode' in the dired mode hook.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-07 8:09 ` Juri Linkov
@ 2004-06-08 6:49 ` Lars Hansen
2004-06-08 8:02 ` Juri Linkov
2004-06-08 20:32 ` Richard Stallman
1 sibling, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-06-08 6:49 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>However, this change is not backward compatible. I can't tell how serious
>this problem is, but users who have the old variable `dired-omit-files-p'
>customized in their .emacs may discover that it doesn't work anymore.
>The reason is that old `dired-omit-files-p' was a global variable
>defined by defcustom, but `dired-omit-mode' is a minor mode defined
>without `:global t' argument.
>
>
I don't see the problem. dired-omit-files-p was buffer-local before my
changes just as dired-omit-mode is now.
According to my test (with vanilla Emacs 21.2 and vanilla CVS Emacs),
things work the same way when dired-omit-files-p is set in .emacs:
With the following two lines in .emacs
(require 'dired-x)
(setq-default dired-omit-files-p t)
omit mode is turned on globally. Observe that setq won't work.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-08 6:49 ` Lars Hansen
@ 2004-06-08 8:02 ` Juri Linkov
2004-06-08 16:10 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-06-08 8:02 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> I don't see the problem. dired-omit-files-p was buffer-local before my
> changes just as dired-omit-mode is now.
> According to my test (with vanilla Emacs 21.2 and vanilla CVS Emacs),
> things work the same way when dired-omit-files-p is set in .emacs:
> With the following two lines in .emacs
>
> (require 'dired-x)
> (setq-default dired-omit-files-p t)
>
> omit mode is turned on globally. Observe that setq won't work.
It doesn't work when dired-omit-files-p is saved in .emacs by customize.
But seems this is a problem of customize: it can't restore variable aliases.
For example, try in a new Emacs session:
(progn
(custom-set-variables '(dired-omit-files-p t))
(require 'dired-x)
dired-omit-files-p)
Returns: nil
And the new `dired-omit-mode' is not a customizable variable
anymore (like `dired-omit-files-p' was before) because it is
defined without `:global t'. This means that users can't customize
this variable and should write the code in .emacs to toggle it
buffer-locally in the dired mode hook.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-08 8:02 ` Juri Linkov
@ 2004-06-08 16:10 ` Lars Hansen
2004-06-08 18:43 ` Juri Linkov
0 siblings, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-06-08 16:10 UTC (permalink / raw)
Cc: emacs-devel
>
>
>It doesn't work when dired-omit-files-p is saved in .emacs by customize.
>
Yes it does, but you have to load dired-x first somehow. You may
considered it a bug in the old version of dired-x that
dired-omit-files-p wasn't declared with :require 'dired-x or had an
autoload cookie. Anyway, you had to load dired-x before the
custom-set-variables call, just as with the new version of dired-x. So
in this respect, nothing is changed.
>For example, try in a new Emacs session:
>
>(progn
> (custom-set-variables '(dired-omit-files-p t))
> (require 'dired-x)
> dired-omit-files-p)
>
>Returns: nil
>
>
Try
(progn
(require 'dired-x)
(custom-set-variables '(dired-omit-files-p t))
dired-omit-files-p)
or
(progn
(custom-set-variables '(dired-omit-files-p t nil (dired-x)))
dired-omit-files-p)
Both return t as expected.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-08 16:10 ` Lars Hansen
@ 2004-06-08 18:43 ` Juri Linkov
2004-06-08 19:24 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-06-08 18:43 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> Yes it does, but you have to load dired-x first somehow. You may
> considered it a bug in the old version of dired-x that
> dired-omit-files-p wasn't declared with :require 'dired-x or had an
> autoload cookie. Anyway, you had to load dired-x before the
> custom-set-variables call, just as with the new version of dired-x. So
> in this respect, nothing is changed.
It works if dired-x is loaded before custom-set-variables, but this
requires modifications of existing .emacs to move loading dired-x
before custom-set-variables. And since users should modify .emacs anyway,
they rather could replace the obsolete variable `dired-omit-files-p'
with `dired-omit-mode' and `dired-mode-hook'. `dired-mode-hook' is
defined by `defcustom', so `dired-omit-mode' can be easily added to it
via Customize which results in adding to user's .emacs something like:
(custom-set-variables
...
'(dired-mode-hook (quote (dired-omit-mode)))
...)
which is good from the point of view of easy customization.
So all what I suggest is to write an appropriate entry in NEWS
with explanations that `dired-omit-files-p' is obsoleted by
`dired-omit-mode' minor mode which can be customized now by
adding `dired-omit-mode' to `dired-mode-hook'.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-08 18:43 ` Juri Linkov
@ 2004-06-08 19:24 ` Lars Hansen
2004-06-08 20:11 ` Juri Linkov
0 siblings, 1 reply; 26+ messages in thread
From: Lars Hansen @ 2004-06-08 19:24 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>It works if dired-x is loaded before custom-set-variables, but this
>requires modifications of existing .emacs to move loading dired-x
>before custom-set-variables.
>
The issue you brought up was backwards caopatibility. As I tried to
explain, with respect to dired-omit-files-p, things are not changed. If
a user sets dired-omit-files-p in .emacs and it works with old dired-x,
it is because dired-x is loaded before setting dired-omit-files-p. So it
will continue to work with new dired-x. If a user sets
dired-omit-files-p in .emacs before dired-x is loaded, it does not work
with old dired-x, and it does not work with new dired-x. That's backward
compatibility. There is no need to change .emacs.
>So all what I suggest is to write an appropriate entry in NEWS
>with explanations that `dired-omit-files-p' is obsoleted by
>`dired-omit-mode' minor mode which can be customized now by
>adding `dired-omit-mode' to `dired-mode-hook'.
>
>
I will do that.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-08 19:24 ` Lars Hansen
@ 2004-06-08 20:11 ` Juri Linkov
2004-06-08 20:22 ` Lars Hansen
0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2004-06-08 20:11 UTC (permalink / raw)
Cc: emacs-devel
Lars Hansen <larsh@math.ku.dk> writes:
> If a user sets dired-omit-files-p in .emacs before dired-x is
> loaded, it does not work with old dired-x, and it does not work with
> new dired-x.
No, it worked with old dired-x, even when dired-omit-files-p was set
in .emacs before dired-x is loaded, because dired-omit-files-p
was defined by defcustom. Just try in the old version:
(progn
(custom-set-variables '(dired-omit-files-p t))
(require 'dired-x)
dired-omit-files-p)
and it sets dired-omit-files-p to t globally.
>>So all what I suggest is to write an appropriate entry in NEWS
>>with explanations that `dired-omit-files-p' is obsoleted by
>>`dired-omit-mode' minor mode which can be customized now by
>>adding `dired-omit-mode' to `dired-mode-hook'.
>
> I will do that.
OK.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-08 20:11 ` Juri Linkov
@ 2004-06-08 20:22 ` Lars Hansen
0 siblings, 0 replies; 26+ messages in thread
From: Lars Hansen @ 2004-06-08 20:22 UTC (permalink / raw)
Cc: emacs-devel
Juri Linkov wrote:
>No, it worked with old dired-x, even when dired-omit-files-p was set
>in .emacs before dired-x is loaded, because dired-omit-files-p
>was defined by defcustom. Just try in the old version:
>
>
You are right. I thought I tested that. I must have done something
wrong. Sorry!
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: desktop.el and minor modes
2004-06-07 8:09 ` Juri Linkov
2004-06-08 6:49 ` Lars Hansen
@ 2004-06-08 20:32 ` Richard Stallman
1 sibling, 0 replies; 26+ messages in thread
From: Richard Stallman @ 2004-06-08 20:32 UTC (permalink / raw)
Cc: larsh, emacs-devel
However, this change is not backward compatible. I can't tell how serious
this problem is, but users who have the old variable `dired-omit-files-p'
customized in their .emacs may discover that it doesn't work anymore.
This is not a tragedy. If you can fix it without much work,
please do, but documenting the change is ok.
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2004-06-08 20:32 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-05 17:59 desktop.el and minor modes Lars Hansen
2004-06-05 18:03 ` David Kastrup
2004-06-05 18:14 ` Lars Hansen
2004-06-05 18:47 ` Juri Linkov
2004-06-07 8:09 ` Juri Linkov
2004-06-08 6:49 ` Lars Hansen
2004-06-08 8:02 ` Juri Linkov
2004-06-08 16:10 ` Lars Hansen
2004-06-08 18:43 ` Juri Linkov
2004-06-08 19:24 ` Lars Hansen
2004-06-08 20:11 ` Juri Linkov
2004-06-08 20:22 ` Lars Hansen
2004-06-08 20:32 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2004-05-30 20:11 Juri Linkov
2004-05-31 10:20 ` Lars Hansen
2004-05-31 13:16 ` Lars Hansen
2004-05-31 13:52 ` Juri Linkov
2004-05-31 16:38 ` Lars Hansen
2004-05-31 19:26 ` Miles Bader
2004-05-31 21:22 ` Lars Hansen
2004-05-31 13:52 ` Juri Linkov
2004-05-31 21:48 ` Lars Hansen
[not found] ` <87vfici4md.fsf@mail.jurta.org>
2004-06-01 6:22 ` Lars Hansen
2004-06-01 16:34 ` Juri Linkov
2004-06-02 5:50 ` Lars Hansen
2004-06-05 1:05 ` Juri Linkov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.