Re: A few questions about desktop.el

2005-08-10 Thread Lars Hansen
Juanma Barranquero wrote:

Anyway, I'd prefer not to make many changes to desktop.el (even quite
non-intrusive changes like these) until Lars returns from holidays, as
he said he would take a look at some questions I posed. I'll post a
patch as soon as I've got it ready, and wait for him.
  

Shall I install the attached patch?
*** /home/lh/cvsroot/emacs/lisp/desktop.el.~1.90.~	2005-08-08 14:15:26.0 +0200
--- /home/lh/cvsroot/emacs/lisp/desktop.el	2005-08-10 11:38:08.519228192 +0200
***
*** 51,63 
  ;; function is added to the `after-init-hook'. This function is
  ;; responsible for loading the desktop when Emacs is started.
  
! ;; Some words on minor modes: Most minor modes are controlled by
! ;; buffer-local variables, which have a standard save / restore
! ;; mechanism.  To handle all minor modes, we take the following
! ;; approach: (1) check whether the variable name from
! ;; `minor-mode-alist' is also a function; and (2) use translation
! ;; table `desktop-minor-mode-table' in the case where the two names
! ;; are not the same.
  
  ;; By the way: don't use desktop.el to customize Emacs -- the file .emacs
  ;; in your home directory is used for that.  Saving global default values
--- 51,116 
  ;; function is added to the `after-init-hook'. This function is
  ;; responsible for loading the desktop when Emacs is started.
  
! ;; Special handling.
! ;; -
! ;; Variables `desktop-buffer-mode-handlers' and `desktop-minor-mode-handlers'
! ;; are supplied to handle special major and minor modes respectively.
! ;; `desktop-buffer-mode-handlers' is an alist of major mode specific functions
! ;; to restore a desktop buffer. Elements must have the form
! ;; 
! ;;(MAJOR-MODE . RESTORE-BUFFER-FUNCTION).
! ;; 
! ;; Functions listed are called by `desktop-create-buffer' when `desktop-read'
! ;; evaluates the desktop file. Buffers with a major mode not specified here,
! ;; are restored by the default handler `desktop-restore-file-buffer'.
! ;; `desktop-minor-mode-handlers' is an alist of functions to restore
! ;; non-standard minor modes.  Elements must have the form
! ;; 
! ;;(MINOR-MODE . RESTORE-FUNCTION).
! ;; 
! ;; Functions are called by `desktop-create-buffer' to restore minor modes.
! ;; Minor modes not specified here, are restored by the standard minor mode
! ;; function.  If you write a module that defines a major or minor mode that
! ;; needs a special handler, then place code like
! 
! ;;(defun foo-restore-desktop-buffer
! ;;...
! ;;(add-to-list 'desktop-buffer-mode-handlers
! ;; '(foo-mode . foo-restore-desktop-buffer))
! 
! ;; or
! 
! ;;(defun bar-desktop-restore
! ;;...
! ;;(add-to-list 'desktop-minor-mode-handlers
! ;; '(bar-mode . bar-desktop-restore))
! 
! ;; in the module itself, and make shure that the mode function is
! ;; autoloaded. See the docstrings of `desktop-buffer-mode-handlers' and
! ;; `desktop-minor-mode-handlers' for more info.
! 
! ;; Minor modes.
! ;; 
! ;; Conventional minor modes (see node Minor Mode Conventions in the elisp
! ;; manual) are handled in the following way:
! ;; When `desktop-save' saves the state of a buffer to the desktop file, it
! ;; saves as `desktop-minor-modes' the list of names of those variables in
! ;; `minor-mode-alist' that have a non-nil value.
! ;; When `desktop-create' restores the buffer, each of the symbols in
! ;; `desktop-minor-modes' is called as function with parameter 1.
! ;; The variables `desktop-minor-mode-table' and `desktop-minor-mode-handlers'
! ;; are used to handle non-conventional minor modes.  `desktop-save' uses
! ;; `desktop-minor-mode-table' to map minor mode variables to minor mode
! ;; functions before writing `desktop-minor-modes'. If a minor mode has a
! ;; variable name that is different form its function name, an entry
! 
! ;;(NAME RESTORE-FUNCTION)
! 
! ;; should be added to `desktop-minor-mode-table'.  If a minor mode should not
! ;; be restored, RESTORE-FUNCTION should be set to nil.  `desktop-create' uses
! ;; `desktop-minor-mode-handlers' to lookup minor modes that needs a restore
! ;; function different from the usual minor mode function.
! ;; ---
  
  ;; By the way: don't use desktop.el to customize Emacs -- the file .emacs
  ;; in your home directory is used for that.  Saving global default values
***
*** 207,226 
:group 'desktop
:version 22.1)
  
! (defcustom desktop-clear-preserve-buffers-regexp
!   ^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*server\\*\\|\\*tramp/.+\\*\\)$
!   Regexp identifying buffers that `desktop-clear' should not delete.
! See also `desktop-clear-preserve-buffers'.
!   :type 'regexp
!   :group 'desktop
!   :version 22.1)
! 
! (defcustom desktop-clear-preserve-buffers nil
!   *List of buffer names that `desktop-clear' should not delete.
! See also 

Re: A few questions about desktop.el

2005-08-10 Thread Juanma Barranquero
On 8/10/05, Lars Hansen [EMAIL PROTECTED] wrote:

 Shall I install the attached patch?

You got my vote. I've been testing it and everything seems to work,
even the corner cases of `highlight-changes-mode'.

BTW, another package that would benefit from special treatment is
bs.el, in particular the variable `bs-buffer-show-mark'. I usually
have documents loaded (like my TODO) that I mark as never to be
shown. On restoring the desktop they should stay so. Adding the
variable to the locals-to-save list is easy enough, of course.

The only (very minor) problem is, if the only buffer you have is
marked as 'never, after restoring the desktop the file is shown. It
should instead show the default *scratch*, I think.

I'm not sure whether this can be fixed with a support function in bs,
though. Properly speaking, bs is not a minor mode, and in fact the
*buffer-selection* buffer is not being restored...

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-08-10 Thread Luc Teirlinck
Lars Hansen wrote:

   Shall I install the attached patch?

The installed changes apparently break bootstrapping:

Compiling /home/teirllm/emacscvsdir/emacs/lisp/./dired-x.el

In toplevel form:
dired-x.el:106:1:Error: Symbol's value as variable is void:
desktop-buffer-mode-handlers
make[1]: *** [compile] Error 1
make[1]: Leaving directory `/home/teirllm/emacscvsdir/emacs/lisp'
make: *** [bootstrap-build] Error 2

This after:

make maintainer-clean
./configure --without-toolkit-scroll-bars
make bootstrap
sudo make install


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-08-10 Thread Luc Teirlinck
The trouble during bootstrapping seems to involve the relationship
between loaddefs.el and ldefs-boot, explained (sort of) in lisp/Makefile.in:

# Prepare a bootstrap in the lisp subdirectory.
#
# Build loaddefs.el to make sure it's up-to-date.  If it's not, that
# might lead to errors during the bootstrap because something fails to
# autoload as expected.  If there is no emacs binary, then we can't
# build autoloads yet.  In that case we have to use ldefs-boot.el;
# bootstrap should always work with ldefs-boot.el.  (Because
# loaddefs.el is an automatically generated file, we don't want to
# store it in the source repository).

But ldefs-boot.el claims to be automatically generated too and it
appears to be stored in the source repository.

desktop-buffer-mode-handlers has a (new) autoload cookie.  That makes
it into loaddefs.el, but not into ldefs-boot.el, which is apparently
necessary for bootstrapping.

I can make bootstrapping work by manually copying the defvar for
desktop-buffer-mode-handlers from loaddefs to ldefs-boot.  I could
install this fix.  However, this does not seem to be the right thing
to do, since ldefs-boot apparently is supposed to contain
_automatically_ extracted autoloads.

What is the right thing to do?

Sincerely,

Luc.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-08-10 Thread Luc Teirlinck
I figured out from the archives that the solution is to copy a good
loaddefs over it.  I will do that, after checking that my version of
loaddefs is not corrupted with local stuff.

Sincerely,

Luc.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-08-10 Thread Luc Teirlinck
From my previous message:

   I figured out from the archives that the solution is to copy a good
   loaddefs over it.

I meant: copy a good copy of loaddefs.el over ldefs-boot.el.

Sincerely,

Luc.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-08-08 Thread Lars Hansen
Juanma Barranquero wrote:

I'm having a few problems with highlight-changes-mode, which is a
not-very-standard minor mode.
  

Yes, the desktop module expects minor modes to follow the conventions.
The only mechanism
to deal with non-conventional minor modes is `desktop-minor-mode-table'
that allows the
minor mode variable and minor mode function to have different names.

To restore highlight changes mode, the function `highlight-changes-mode'
needs to be
called with the value of `highlight-changes-mode' to get the correct
sub-mode. So what
is needed is something like `desktop-buffer-mode-handlers', but for
minor modes.
I suggest the patch below.
It allows modules defining minor modes to define their own restore
function without
having to change the desktop module.

The other question is: why does `desktop-save' save `nil' for active
minor-modes which do appear in `desktop-minor-mode-table' as
non-restorable?
  

I don't think there is any good reason. The patch below includes your
suggested change
(the second one).

Now I have a question: To allow modules defining major or minor modes to
add a special
handler to `desktop-buffer-mode-handlers' or
`desktop-minor-mode-handlers', the module
in question must be loaded before the major or minor mode function is
called. To do that,
the patch below defines the following function:

   (defun desktop-load-file (function)
 Load the file where auto loaded FUNCTION is defined.
 (let ((fcell (symbol-function function)))
   (when (and (listp fcell)
  (eq 'autoload (car fcell)))
 (load (cadr fcell)

This function assumes that the mode function is autoloaded. Is this
requirement ok?
Is there a better solution?


*** /home/lh/cvsroot/emacs/lisp/desktop.el	2005-08-08 14:15:26.0 +0200
--- /home/lh/emacs/LH-work/desktop/new.desktop.el	2005-08-08 16:27:09.416541856 +0200
***
*** 51,63 
  ;; function is added to the `after-init-hook'. This function is
  ;; responsible for loading the desktop when Emacs is started.
  
! ;; Some words on minor modes: Most minor modes are controlled by
! ;; buffer-local variables, which have a standard save / restore
! ;; mechanism.  To handle all minor modes, we take the following
! ;; approach: (1) check whether the variable name from
! ;; `minor-mode-alist' is also a function; and (2) use translation
! ;; table `desktop-minor-mode-table' in the case where the two names
! ;; are not the same.
  
  ;; By the way: don't use desktop.el to customize Emacs -- the file .emacs
  ;; in your home directory is used for that.  Saving global default values
--- 51,116 
  ;; function is added to the `after-init-hook'. This function is
  ;; responsible for loading the desktop when Emacs is started.
  
! ;; Special handling.
! ;; -
! ;; Variables `desktop-buffer-mode-handlers' and `desktop-minor-mode-handlers'
! ;; are supplied to handle special major and minor modes respectively.
! ;; `desktop-buffer-mode-handlers' is an alist of major mode specific functions
! ;; to restore a desktop buffer. Elements must have the form
! ;; 
! ;;(MAJOR-MODE . RESTORE-BUFFER-FUNCTION).
! ;; 
! ;; Functions listed are called by `desktop-create-buffer' when `desktop-read'
! ;; evaluates the desktop file. Buffers with a major mode not specified here,
! ;; are restored by the default handler `desktop-restore-file-buffer'.
! ;; `desktop-minor-mode-handlers' is an alist of functions to restore
! ;; non-standard minor modes.  Elements must have the form
! ;; 
! ;;(MINOR-MODE . RESTORE-FUNCTION).
! ;; 
! ;; Functions are called by `desktop-create-buffer' to restore minor modes.
! ;; Minor modes not specified here, are restored by the standard minor mode
! ;; function.  If you write a module that defines a major or minor mode that
! ;; needs a special handler, then place code like
! 
! ;;(defun foo-restore-desktop-buffer
! ;;...
! ;;(add-to-list 'desktop-buffer-mode-handlers
! ;; '(foo-mode . foo-restore-desktop-buffer))
! 
! ;; or
! 
! ;;(defun bar-desktop-restore
! ;;...
! ;;(add-to-list 'desktop-minor-mode-handlers
! ;; '(bar-mode . bar-desktop-restore))
! 
! ;; in the module itself, and make shure that the mode function is
! ;; autoloaded. See the docstrings of `desktop-buffer-mode-handlers' and
! ;; `desktop-minor-mode-handlers' for more info.
! 
! ;; Minor modes.
! ;; 
! ;; Conventional minor modes (see node Minor Mode Conventions in the elisp
! ;; manual) are handled in the following way:
! ;; When `desktop-save' saves the state of a buffer to the desktop file, it
! ;; saves as `desktop-minor-modes' the list of names of those variables in
! ;; `minor-mode-alist' that have a non-nil value.
! ;; When `desktop-create' restores the buffer, each of the symbols in
! ;; `desktop-minor-modes' is called as function with parameter 1.
! ;; The variables `desktop-minor-mode-table' and `desktop-minor-mode-handlers'
! ;; are used to 

Re: A few questions about desktop.el

2005-08-08 Thread Lars Hansen
Juanma Barranquero wrote:

In fact, I'm not sure what criterion is used to decide the default
value of `desktop-locals-to-save'.

I guess it should include variables set directly or indirectly by the
user to control
some kind of customization, minor modes excluded. But that's not exactly
a precise
criterion :-)




___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-28 Thread Juanma Barranquero
On 7/28/05, David Kastrup [EMAIL PROTECTED] wrote:

 There is no guarantee that the stored desktop file will get used on
 the same display, not even with the same Emacs.  And what if you do
 emacs -nw ?

Even with -nw Emacs supports multiple frames and multiple windows.
Moreover, at the very worst what can happen? Emacs not creating enough
windows?

 It sounds like something that has potential for problems,

Sure.

 certainly
 enough to push it till after release.

I agree, not because of the problems you see, but because it is a new
feature (I wouldn't count adding this to desktop.el as a bug fix).

I don't think we should be postponing features with potential for
problems; we should be postponing *all* new features. IMO.

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-28 Thread David Kastrup
Richard M. Stallman [EMAIL PROTECTED] writes:

 It's quite useful, and it'll be great the day we can make it
 save/restore window and frame configurations. But I don't think
 there's an easy way to turn a window configuration into elisp and back

 It is straightforward to do walk-windows and record the size and
 contents of each leaf window.  It's necessary in addition to record
 the structure.  I think this can be deduced from that info as
 follows:

There is no guarantee that the stored desktop file will get used on
the same display, not even with the same Emacs.  And what if you do
emacs -nw ?

It sounds like something that has potential for problems, certainly
enough to push it till after release.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-28 Thread Richard M. Stallman
There is no guarantee that the stored desktop file will get used on
the same display, not even with the same Emacs.  And what if you do
emacs -nw ?

What's the problem?  If it does not make sense to restore the window
configuration, don't restore it.

It sounds like something that has potential for problems, certainly
enough to push it till after release.

Yes, this is for after the release.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-28 Thread Juanma Barranquero
On 7/28/05, Richard M. Stallman [EMAIL PROTECTED] wrote:

 How about if you start checking them.  That is the only way to find
 out if these two variables would really improve the situation.

Yeah, I'll do that.

 Also, the customization mechanism for the minor modes to use does not
 have to be a function to call.  It may be that an alist which major
 modes can add to would be cleaner.

In fact, the current API, which is a list of lists and alists, is
quite clean except for the variables that store regexps:
`desktop-clear-preserve-buffers-regexp',
`desktop-buffers-not-to-save', `desktop-files-not-to-save'. The easier
way to customize these would be turning them into lists and adding
functions to generate the regexps from the lists.

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-28 Thread Juanma Barranquero
On 7/28/05, Richard M. Stallman [EMAIL PROTECTED] wrote:

 It needs to use file-locking together with testing of the file modtime.
 There are primitives to do this: lock-file and unlock-file,
 and file-attributes.

I don't see any `lock-file' and `unlock-file'. There are functions
`lock-buffer', `unlock-buffer', and `file-locked-p'. Unfortunately,
they do nothing on Windows.

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Juanma Barranquero
On 7/27/05, Richard M. Stallman [EMAIL PROTECTED] wrote:

 How many minor modes could you take care of with just those two?

Difficult to say without looking at each one, particularly because
we're talking not of the normal minor modes, but the ones that do a
minor-mode work in a non-conventional way: highlight-change,
overwrite, indent-tabs...

All in all, though, I suppose that most of them. But, as a datapoint,
I recently added *server* directly to
`desktop-clear-preserve-buffers-regexp' in desktop.el; now I see the
clean way would be for server.el to add it (but that would require a
redesign of a bit of desktop.el interface).

[time passes...]

You're gonna say Then add a function to customize these two and we'll
see whether we need to add anything more, aren't you? :) OK, I'll see
what I can do.

Anyway, I'd prefer not to make many changes to desktop.el (even quite
non-intrusive changes like these) until Lars returns from holidays, as
he said he would take a look at some questions I posed. I'll post a
patch as soon as I've got it ready, and wait for him.

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Richard M. Stallman
and the various hooks. I see no clear pattern about what would other
packages want to modify; *-locals-to-save and *-minor-mode-table are
perhaps the most useful, but other than that everything's game.

How many minor modes could you take care of with just those two?


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Richard M. Stallman
AFAICS, `desktop-save' already saves all active minor-modes except
those listed in `desktop-minor-mode-table', which get special
processing. The ones listed above are ones that should need a special
processing because they're not normal minor modes (there's no
`indent-tabs-mode' function, for example).

As you can see, I don't know much about desktop.el--I don't use it.

If you see that a certain mode needs special processing,
please just implement that.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Richard M. Stallman
It'd be very useful to try to detect it and at least stop the second
instance from loading and using the desktop file if it's already in
use. There's no way to do that from Emacs, is there?

It needs to use file-locking together with testing of the file modtime.
There are primitives to do this: lock-file and unlock-file,
and file-attributes.  So when you restore an old desktop, you
record the modtime of the file.  When you update the desktop file,
you lock it, them see if its modtime is the same as it was
when you restored the desktop.  If not, you do whatever.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Richard M. Stallman
 How many minor modes could you take care of with just those two?

Difficult to say without looking at each one, particularly because
we're talking not of the normal minor modes, but the ones that do a
minor-mode work in a non-conventional way: highlight-change,
overwrite, indent-tabs...

How about if you start checking them.  That is the only way to find
out if these two variables would really improve the situation.

You're gonna say Then add a function to customize these two and we'll
see whether we need to add anything more, aren't you? :) OK, I'll see
what I can do.

Not exactly.  The first step is to see how much good this would do.
Also, the customization mechanism for the minor modes to use does not
have to be a function to call.  It may be that an alist which major
modes can add to would be cleaner.  That's entirely a matter of
details.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Richard M. Stallman
It's quite useful, and it'll be great the day we can make it
save/restore window and frame configurations. But I don't think
there's an easy way to turn a window configuration into elisp and back

It is straightforward to do walk-windows and record the size and
contents of each leaf window.  It's necessary in addition to record
the structure.  I think this can be deduced from that info as follows:

Notice when consecutive windows (in the standard window ordering) have
the same left and right edges, and when they have the same top and
bottom edges.  In those cases, you have vertical or horizontal
siblings.  So make a list of them and replace them with an item
that corresponds to the combination of them.

Do this over and over until you're left with one window,
and you've reconstructed the whole tree.

We could add a primitive which constructs a window configuration
from a list of window sizes and contents.  If the above algorithm
fails to reduce the specified data to a single window, it would
signal an error.

(We could conceive of making window configurations transparent data
using this method.  This would make save-window-configuration slower;
would it be enough slowdown to cause a problem?  Perhaps nowadays
it would not be a problem.)


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-27 Thread Masatake YAMATO
  As you can see, I don't know much about desktop.el--I don't use it.
 
 It's quite useful, and it'll be great the day we can make it
 save/restore window and frame configurations. But I don't think
 there's an easy way to turn a window configuration into elisp and back
 :(

Look at HIROSE-san's hack.
http://www.gentei.org/~yuuji/software/revive.el

Masatake


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-26 Thread Juanma Barranquero
Regarding this code in `desktop-save':

   (setq default-directory dirname)
   (when (file-exists-p filename) (delete-file filename))
   (let ((coding-system-for-write 'emacs-mule))
 (write-region (point-min) (point-max) filename nil 'nomessage

No one, not even the original author (I've just asked him), knows for
sure whether the `delete-file' call is needed or why, and I know for
certain it can produce some unexpected results in Windows
(unexpected including data loss, meaning losing the .emacs.desktop
file).

So, if no one objects, in a few days I'm gonna delete that line. As
we're not even in pretesting, we'll have plenty of time to know
whether it causes problems in some environment or other, and
reintroduce it (conditional to non-Windows, or not) if needed.

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-26 Thread Juanma Barranquero
On 7/23/05, Richard M. Stallman [EMAIL PROTECTED] wrote:
   - indent-tabs-mode
   - indicate-buffer-boundaries
   - indicate-empty-lines
   - show-trailing-whitespace
 
 I guess those are all reasonable to include.
 
 How about this: save all minor modes, based on minor-mode-list.

AFAICS, `desktop-save' already saves all active minor-modes except
those listed in `desktop-minor-mode-table', which get special
processing. The ones listed above are ones that should need a special
processing because they're not normal minor modes (there's no
`indent-tabs-mode' function, for example).

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-26 Thread Juanma Barranquero
On 7/23/05, Richard M. Stallman [EMAIL PROTECTED] wrote:

 However, making that possible would probably require
 another way to customize desktop.el.  It would be useful to add
 a suitable mechanism to desktop.el that would make this possible
 in a clean way.

I can add that mechanism, but I'm not sure it is worth it. There are a
bunch of variables that other packages could possibly want to modify:

  desktop-globals-to-save
  desktop-globals-to-clear
 desktop-clear-preserve-buffers-regexp
 desktop-clear-preserve-buffers
 desktop-locals-to-save
 desktop-buffers-not-to-save
 desktop-files-not-to-save
 desktop-modes-not-to-save
 desktop-buffer-mode-handlers
 desktop-minor-mode-table

and the various hooks. I see no clear pattern about what would other
packages want to modify; *-locals-to-save and *-minor-mode-table are
perhaps the most useful, but other than that everything's game. I
don't see what do we gain by adding functions to manipulate these vars
instead of doing it directly.
  
-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-22 Thread Juanma Barranquero
On 7/22/05, Juanma Barranquero [EMAIL PROTECTED] wrote:

 instead of simply
 
   (let ((special (cadr (assq minor-mode desktop-minor-mode-table
 (when (or special (functionp minor-mode))
   (add-to-list 'ret (or special minor-mode

My fault, for posting untested code. I meant:

  (let* ((special (assq minor-mode desktop-minor-mode-table))
 (value (cond (special (cadr special))
  ((functionp minor-mode) minor-mode
(when value (add-to-list 'ret value)

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-22 Thread Juanma Barranquero
The very end of `desktop-save' contains:

  (setq default-directory dirname)
  (when (file-exists-p filename) (delete-file filename))
  (let ((coding-system-for-write 'emacs-mule))
(write-region (point-min) (point-max) filename nil 'nomessage

The code to delete the desktop file before writing into it has
existed, AFAICS, since release 1.1 of desktop.el.

However, it is bringing me pain on Windows. If I try to exit Emacs
while viewing the .emacs.desktop from a command shell, Emacs tries to
delete the file (and apparently succeeds), and then tries to write it
anew (and it fails). After exiting the viewer program, .emacs.desktop
no longer exists. Not nice.

It is really necessary to delete the file prior to `write-region' it?
Are there use cases where that is an advantage?

-- 
/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-22 Thread Lars Hansen
Juanma Barranquero wrote:
 (These questions are mainly for Lars Hansen, who did most of the
 recent cleanup work on desktop.el)
I am just about to go to Greece on vacation, far away form e-mail. But I
will be glad to use a bit of time to look into your questions (I bring a
laptop). When I return in about 16 days, I will post an answer.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-22 Thread Juanma Barranquero
On 7/22/05, Lars Hansen [EMAIL PROTECTED] wrote:

 But I
 will be glad to use a bit of time to look into your questions (I bring a
 laptop). When I return in about 16 days, I will post an answer.

Thanks, and happy holidays.

/L/e/k/t/u


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-22 Thread Richard M. Stallman
  - indent-tabs-mode
  - indicate-buffer-boundaries
  - indicate-empty-lines
  - show-trailing-whitespace

I guess those are all reasonable to include.

How about this: save all minor modes, based on minor-mode-list.

and I'm not sure why does it include `line-number-mode'. Why not
`column-number-mode' or `size-indication-mode'?

Those are newer and not used much, so most likely nobody thought to add
them.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel


Re: A few questions about desktop.el

2005-07-22 Thread Richard M. Stallman
It would be cleaner if this could be done with code in hilit-chg.el
itself.  However, making that possible would probably require
another way to customize desktop.el.  It would be useful to add
a suitable mechanism to desktop.el that would make this possible
in a clean way.


___
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel