michael@cadilhac.name (Michaël Cadilhac) writes: > (defun create-file-buffer (filename) > "Create a suitably named buffer for visiting FILENAME, and return it. > FILENAME (sans directory) is used unchanged if that name is free; > ! otherwise a string <2> or <3> or ... is appended to get an unused name. > ! Spaces at the start of FILENAME (sans directory) are removed." > (let ((lastname (file-name-nondirectory filename))) > (if (string= lastname "") > (setq lastname filename)) > ! (save-match-data > ! (string-match "^ *\\(.*\\)" lastname) > ! (generate-new-buffer (match-string 1 lastname))))) > > (defun generate-new-buffer (name) > "Create and return a buffer with a name based on NAME. Installed. -- | Michaël `Micha' Cadilhac | ape this thing, | | http://michael.cadilhac.name | uit and | | JID/MSN: | do urn. | `---- michael.cadilhac@gmail.com | -- VI - --'