home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / gnu / emacs / help / 5084 < prev    next >
Encoding:
Text File  |  1992-12-15  |  3.7 KB  |  99 lines

  1. Newsgroups: gnu.emacs.help
  2. Path: sparky!uunet!cis.ohio-state.edu!matis.INgr.COM!amir
  3. From: amir@matis.INgr.COM (Amir J Katz)
  4. Subject: SUMMARY: emacs keeps emacsclient-generated buffer?
  5. Message-ID: <9212150840.AA26541@simpson.ingr.com>
  6. Sender: daemon@cis.ohio-state.edu
  7. Reply-To: amir@matis.ingr.com
  8. Organization: SEE Technologies Ltd.
  9. Date: Tue, 15 Dec 1992 10:40:25 GMT
  10. Lines: 87
  11.  
  12. Recently, I have posted the following query:
  13.  
  14. > I've just discovered the wonders of emacsclient. One thing bothers me,
  15. > though. When I hit 'C-x #' to signal emacsclient that I'm done with the
  16. > buffer, the buffer is buried, not killed, even though that the corresponding
  17. > temp file has been removed. If emacsclient is invoked again from the same
  18. > process (say, elm), the same temp file is generated and emacs still has the
  19. > buffer, so it asks whether I want to revert the buffer. This is a nuisance. 
  20. > Is there a way to cause the 'C-x #' not to bury the buffer but to blow it
  21. > away completely?
  22.  
  23. Thanks to:
  24.  
  25. Vivek Khera   <khera@cs.duke.edu>
  26. Bruce Hoylman <bruce@advtech.uswest.com>
  27. Ken Manheimer <klm@nist.gov>
  28.  
  29. Vivek Khera and Bruce Hoylman suggested using the gnuserv/gnuclient package.
  30.  
  31. ---------------------------------------------------------
  32. Bruce Hoylman suggested a minor fix for server.el:
  33.  
  34. Bruce> I wanted the same thing, so I made the following change.  You can
  35. Bruce> apply this using the patch() utility:
  36.  
  37. *** /usr/local/emacs/lisp/server.el     Tue Jun  5 00:11:29 1990
  38. --- server.el   Mon Jun  8 21:35:12 1992
  39. ***************
  40. *** 204,210 ****
  41.           (save-excursion
  42.             (set-buffer buffer)
  43.             (setq server-buffer-clients nil)))
  44. !     (bury-buffer buffer)
  45.       next-buffer))
  46.   
  47.   (defun mh-draft-p (buffer)
  48. --- 204,211 ----
  49.           (save-excursion
  50.             (set-buffer buffer)
  51.             (setq server-buffer-clients nil)))
  52. !     (message "Killing buffer ...")
  53. !     (kill-buffer buffer)
  54.       next-buffer))
  55.   
  56.   (defun mh-draft-p (buffer)
  57.  
  58. Bruce> This simply kills the client buffer and puts out a message saying it
  59. Bruce> is doing so instead of pushing it down the buffer stack.  Works great!
  60.  
  61. ---------------------------------------------------------
  62. Ken Manheimer offered the following:
  63. ---------------------------------------------------------
  64. Ken> Here's the kludge i use, defined in my .emacsrc, to ease disposal of
  65. Ken> emacsclient buffers.  I think it's sound, i've been using something
  66. Ken> like it for a while now.  I suspect it could be implemented more
  67. Ken> cleanly.  Then again, i suspect the server buffer management stuff
  68. Ken> could be implemented more cleanly, but that'd certainly take a lot
  69. Ken> more work.
  70.                        
  71. (load-library "server")                 ; Load it so ^X-# key can be overriden.
  72.  
  73. (global-set-key "\C-x#" 'my-server-edit)
  74.  
  75. (defun my-server-edit (arg)
  76.  "Like server-edit, but a bare ^U repeat count (= 4) means kill the buffer,
  77. too.  Any other (or no) repeat count behaves just as server edit
  78. normally would."
  79.  (interactive "p")
  80.  (let ((target-buffer
  81.         (if (and (= arg 4) server-buffer-clients)
  82.             (current-buffer))))
  83.    (server-edit)
  84.    (if target-buffer
  85.        (kill-buffer target-buffer))
  86.    )
  87.  )
  88.  
  89. ---------------------------------------------------------
  90. I've implemented Bruce Hoylman's solution - just copied server.el to
  91. my-server.el in my emacs programs directory, made the fix and load
  92. 'my-server' instead of 'server'. Works great.
  93. -- 
  94. /* ----------------------------------------------------------- */
  95. /*  Amir J. Katz             |   amir@matis.ingr.COM           */
  96. /*  System Specialist        |   Voice:  +972 52-584684        */
  97. /*  SEE Technologies Ltd.    |   Fax:    +972 52-543917        */
  98. /* ............ Solaris 2.0 - The Final Frontier ? ........... */
  99.