Loading ...
Sorry, an error occurred while loading the content.

Wierd read-file behaviour in ME09

Expand Messages
  • Gomes, Pedro (NSN - PT/Amadora)
    Hi All, I got some weird behaviour in Micro Emacs 2009 (0909). If I define the macro above and press C-f12 to reread the current buffer, it re-read the
    Message 1 of 2 , Sep 22, 2009
    • 0 Attachment
      Wierd read-file behaviour in ME09

      Hi All,
      I got some 'weird' behaviour in Micro Emacs 2009 (0909).

      If I define the macro above and press C-f12 to reread the current buffer, it re-read the current buffer, but it removes some other buffer from the buffer list. If I have 10 buffers besides the one I want to reread and I press the C-f12 combination 10 times I will be left with only the current buffer and nothing else (and the scratch buffer of course).

      Initially I thought it was due to 'delete-buffer' which I believe its irrelevant since the read-file rewrites the current buffer.

      Can you explain what might be happening ?

      Regards,
      Pedro

      P.S. - By the way, congrats on the new release, looks quite stable!! :P

      define-macro reread-file-with-prompt
          set-variable #l1 $window-aline
          set-variable #l2 $buffer-fname
         
          0x1 delete-buffer $buffer-bname  ; force destroy (prompting user doesn't work in macro)
          ml-write &spr "[Rereading %s]" #l2
          read-file #l2
         
          #l1 goto-line
      !emacro

      !force global-bind-key reread-file-with-prompt "C-f12"

    • Steven Phillips
      Pedro, The problem is caused by your use of read-file, this command replaces the current buffer with the loaded file, i.e. this command is equivalent to a
      Message 2 of 2 , Sep 22, 2009
      • 0 Attachment
        Pedro,

        The problem is caused by your use of read-file, this command replaces the current buffer with the loaded file, i.e. this command is equivalent to a delete-buffer followed by a find-file. Problem is you have already deleted the current buffer using delete-buffer, so in effect you are calling delete-buffer twice and then find-file - not what you meant, try changing read-file with find-file.

        As a side note, the macro does not check that the current buffer has got a file name associated with it which is dangerous, I suggest you take a copy of reread-file from tools.emf and modify that to meet your requirement.

        Steve

        Gomes, Pedro (NSN - PT/Amadora) wrote:
         

        Hi All,
        I got some 'weird' behaviour in Micro Emacs 2009 (0909).

        If I define the macro above and press C-f12 to reread the current buffer, it re-read the current buffer, but it removes some other buffer from the buffer list. If I have 10 buffers besides the one I want to reread and I press the C-f12 combination 10 times I will be left with only the current buffer and nothing else (and the scratch buffer of course).

        Initially I thought it was due to 'delete-buffer' which I believe its irrelevant since the read-file rewrites the current buffer.

        Can you explain what might be happening ?

        Regards,
        Pedro

        P.S. - By the way, congrats on the new release, looks quite stable!! :P

        define-macro reread-file- with-prompt
            set-variable #l1 $window-aline
            set-variable #l2 $buffer-fname
           
            0x1 delete-buffer $buffer-bname  ; force destroy (prompting user doesn't work in macro)
            ml-write &spr "[Rereading %s]" #l2
            read-file #l2
           
            #l1 goto-line
        !emacro

        !force global-bind- key reread-file- with-prompt "C-f12"

      Your message has been successfully submitted and would be delivered to recipients shortly.