Browse files

* gimp-mode.el (gimp-completion-rules): enhance rule for palettes

(gimp-shortcuts): gimp-clear (,clear from REPL) was added, to
clear the REPL screen.
(gimp-fnsym-in-current-sexp): fix for list beginning with a
number (that bugged `gimp-echo' higher up the stack): now returns
nil when the symbol begins with a number.
(gimp-echo): change cache-resp into response, as we're (a long
time..) not using caches anymore to save the echoing.

* gimp-install.el (gimp-install): put installation in a function,
then call it.

* gimp-mode.el (gimp-switch-to-latest-source-buffer): made this
functionality a separate command, and enhanced it so that you will
switch to another source buffer if already in a source buffer.
(gimp-help-mode-map): removed gimp-help-refresh (which isn't a
command)
(gimp-mode): Add some rules to highlight the frequent use of
UPPERCASE CONSTANTS in script-fu. This required turning off
CASE-FOLD in `gimp-mode'.
(fud): FUD: the new fu debugger
(gimp-comint-filter): add FUD actions
(gimp-send-last-sexp): call `fud-update-breakpoints' before
sending something to the GIMP.
(gimp-send-input): call `fud-update-breakpoints' before
sending input to the GIMP.
  • Loading branch information...
1 parent 16c07e9 commit c107a2b4de6bae5907173dcc259f63db1d482be4 sharik committed Aug 1, 2008
Showing with 343 additions and 127 deletions.
  1. +33 −0 ChangeLog
  2. +55 −1 THOUGHTS
  3. +3 −1 gimp-init.el
  4. +72 −65 gimp-install.el
  5. +180 −60 gimp-mode.el
View
33 ChangeLog
@@ -1,3 +1,36 @@
+2008-08-01 Niels Giesen <sharik@localhost>
+
+ * gimp-mode.el (gimp-completion-rules): enhance rule for palettes
+ (gimp-shortcuts): gimp-clear (,clear from REPL) was added, to
+ clear the REPL screen.
+ (gimp-fnsym-in-current-sexp): fix for list beginning with a
+ number (that bugged `gimp-echo' higher up the stack): now returns
+ nil when the symbol begins with a number.
+ (gimp-echo): change cache-resp into response, as we're (a long
+ time..) not using caches anymore to save the echoing.
+
+ * gimp-install.el (gimp-install): put installation in a function,
+ then call it.
+
+ * fud.el (Module): new FUD FU debugger - elisp side
+
+ * fud.scm (Module): new FUD FU debugger - scheme side
+
+ * gimp-mode.el (gimp-switch-to-latest-source-buffer): made this
+ functionality a separate command, and enhanced it so that you will
+ switch to another source buffer if already in a source buffer.
+ (gimp-help-mode-map): removed gimp-help-refresh (which isn't a
+ command)
+ (gimp-mode): Add some rules to highlight the frequent use of
+ UPPERCASE CONSTANTS in script-fu. This required turning off
+ CASE-FOLD in `gimp-mode'.
+ (fud): FUD: the new fu debugger
+ (gimp-comint-filter): add FUD actions
+ (gimp-send-last-sexp): call `fud-update-breakpoints' before
+ sending something to the GIMP.
+ (gimp-send-input): call `fud-update-breakpoints' before
+ sending input to the GIMP.
+
2008-07-29 <ngiesen@NIELS>
* gimp-mode.el (inferior-gimp-mode-map): fix for buf introduced in
View
56 THOUGHTS
@@ -7,4 +7,58 @@
functions and variables that you'd like to make available in both
modes. Say we want some keys to perform certain actions in both
modes, but the console mode is derived from - say - comint-mode and
- the text buffer mode is derived from lisp-mode.
+ the text buffer mode is derived from lisp-mode.
+
+add constants to font-locking
+
+step inside for breakpoints ...
+
+need pattern matching I guess...
+
+lambda
+define
+let
+let*
+letrec
+letrec*
+define-macro
+do
+dolist
+
+(lambda ()
+ .....)
+==>
+(db
+ (lambda ()
+ (db-recurse ....)))
+
+
+(define (fun args*)
+ body*)
+==>
+(db (define (fun args*)
+ (db-recurse body*)))
+
+(let loop? (())
+ ...)
+==>
+(db (let loop (())
+ (db-recurse body*)))
+
+(letrec (())
+ body*)
+==>
+(db (letrec (())
+ (db-recurse body*)))
+
+(do ((var init step)*)
+ (test)
+ (body))
+==>
+(db (do ((var (db-recurse init) (db-recurse step)) *)
+ ((db-recurse test) (db result))
+ (db-recurse body*)))
+
+
+
+
View
4 gimp-init.el
@@ -1,4 +1,4 @@
-;;; gimp-init.el --- $Id: gimp-init.el,v 1.16 2008-07-24 09:05:14 sharik Exp $
+;;; gimp-init.el --- $Id: gimp-init.el,v 1.17 2008-08-01 17:38:06 sharik Exp $
;; Copyright (C) 2008 Niels Giesen.
;; Author: Niels Giesen <nielsforkgiesen@gmailspooncom, but please
@@ -45,6 +45,8 @@
gimp-selector
gimp-open-image
gimp-cl-connect))
+
+(autoload 'gimp-install "gimp-install.el")
;; Uncomment the following line to have a nice selector:
;(global-set-key "\C-cg" 'gimp-selector)
View
137 gimp-install.el
@@ -1,4 +1,4 @@
-;;; gimp-install.el --- $Id: gimp-install.el,v 1.6 2008-07-21 17:36:28 sharik Exp $
+;;; gimp-install.el --- $Id: gimp-install.el,v 1.7 2008-08-01 17:38:06 sharik Exp $
;; Copyright (C) 2008 Niels Giesen.
;; Author: Niels Giesen <nielsforkgiesen@gmailspooncom, but please
@@ -50,73 +50,80 @@ For more information consult the file README."
(forward-list 2))
(setq buffer-read-only t))
-
-(let* ((gmd (file-name-directory
- (or load-file-name buffer-file-name)))
- (gimp-dir
- (expand-file-name
- (read-directory-name
- "Please enter config directory for the GIMP: "
- (if (eq window-system 'w32)
- (format "C:/Documents and Settings/%s/%s"
- user-login-name
- ".gimp-2.4/")
- "~/.gimp-2.4/"))))
- (gimp-emacs-dir (expand-file-name (concat gimp-dir "/emacs/")))
- (emacs-interaction.scm "emacs-interaction.scm")
- (emacs-interaction.scm-target
- (expand-file-name
- (mapconcat 'identity
- (list gimp-dir
- "scripts"
- emacs-interaction.scm)
- "/")))
- (gimp-init-file (concat gmd "gimp-init.el")))
- (unless (file-exists-p gimp-emacs-dir)
- (message "Making directory %s for communication emacs<->gimp..."
- gimp-emacs-dir
- (make-directory gimp-emacs-dir)))
- (message "Installing %s..." emacs-interaction.scm-target)
- (let (done
- (funs (if (fboundp 'make-symbolic-link)
- '(make-symbolic-link copy-file)
- '(copy-file))))
- (dolist (fun '(make-symbolic-link copy-file))
- (unless done
- (condition-case err
- (progn
- (apply fun
- (list
- (expand-file-name
- (concat gmd emacs-interaction.scm))
- emacs-interaction.scm-target
- t))
- (setq done t))
- (error (message "%s" (error-message-string err)))))))
- (progn
- (find-file-literally (concat gmd "gimp-vars.el"))
- (erase-buffer)
- (insert ";;This file was autogenerated by gimp-install, do not modify")
- (print
- `(defcustom gimp-dir (expand-file-name ,gimp-dir)
- "User configuration directory for the GIMP.
+(defun gimp-install (&optional to-dir)
+ (interactive)
+ (let* ((gmd (file-name-directory
+ (or load-file-name buffer-file-name)))
+ (gimp-dir
+ (or to-dir
+ (expand-file-name
+ (read-directory-name
+ "Please enter config directory for the GIMP: "
+ (if (eq window-system 'w32)
+ (format "C:/Documents and Settings/%s/%s"
+ user-login-name
+ ".gimp-2.4/")
+ "~/.gimp-2.4/")))))
+ (gimp-emacs-dir (expand-file-name (concat gimp-dir "/emacs/")))
+ (emacs-interaction.scm "emacs-interaction.scm")
+ (emacs-interaction.scm-target
+ (expand-file-name
+ (mapconcat 'identity
+ (list gimp-dir
+ "scripts"
+ emacs-interaction.scm)
+ "/")))
+ (gimp-init-file (concat gmd "gimp-init.el")))
+ (unless (file-exists-p gimp-emacs-dir)
+ (message "Making directory %s for communication emacs<->gimp..."
+ gimp-emacs-dir
+ (make-directory gimp-emacs-dir)))
+ (message "Installing %s..." emacs-interaction.scm-target)
+ (let (done
+ (funs (if (fboundp 'make-symbolic-link)
+ '(make-symbolic-link copy-file)
+ '(copy-file))))
+ (dolist (fun '(make-symbolic-link copy-file))
+ (unless done
+ (condition-case err
+ (progn
+ (apply fun
+ (list
+ (expand-file-name
+ (concat gmd emacs-interaction.scm))
+ emacs-interaction.scm-target
+ t))
+ (setq done t))
+ (error (message "%s" (error-message-string err)))))))
+
+ (progn
+ (find-file-literally (concat gmd "gimp-vars.el"))
+ (erase-buffer)
+ (insert ";;This file was autogenerated by gimp-install, do not modify")
+ (print
+ `(defcustom gimp-dir (expand-file-name ,gimp-dir)
+ "User configuration directory for the GIMP.
the GIMP puts its caches here. Retrieve it by evaluating the variable
`gimp-dir' in GIMP script-fu console.
It is advised to run `gimp-install.el' to change this variable and
stuff depending on it."
- :group 'gimp-directories
- :type 'string)
- (current-buffer))
- (save-buffer)
- (kill-buffer (current-buffer)))
- (load gimp-init-file)
- (byte-compile-file
- (concat gmd "gimp-mode.el"))
- (byte-compile-file
- (concat gmd "related/scheme-complete.el"))
- (byte-compile-file
- (concat gmd "related/snippet.el"))
- (gimp-install-message))
-
+ :group 'gimp-directories
+ :type 'string)
+ (current-buffer))
+ (save-buffer)
+ (kill-buffer (current-buffer)))
+
+ (load gimp-init-file)
+ (byte-compile-file
+ (concat gmd "gimp-mode.el"))
+ (byte-compile-file
+ (concat gmd "related/scheme-complete.el"))
+ (byte-compile-file
+ (concat gmd "related/snippet.el"))
+ (gimp-install-message)))
+
+(gimp-install)
+
+;; (provide 'gimp-install)
View
240 gimp-mode.el
@@ -1,4 +1,4 @@
-;;; gimp-mode.el --- $Id: gimp-mode.el,v 1.45 2008-07-29 07:58:39 sharik Exp $
+;;; gimp-mode.el --- $Id: gimp-mode.el,v 1.46 2008-08-01 17:38:06 sharik Exp $
;; Copyright (C) 2008 Niels Giesen
;; Author: Niels Giesen <nielsforkgiesen@gmailspooncom, but please
@@ -58,6 +58,7 @@
(require 'cl)
(require 'eldoc)
(require 'thingatpt)
+(require 'fud)
(eval-when-compile (load "gimp-init.el"))
(eval-when (compile load)
(require 'ring)
@@ -195,6 +196,10 @@ HINT is the help-echo, and face the gimp-FACE-face."
"Gimp Mode face used to highlight variable names."
:group 'gimp-faces)
+(font-lock-add-keywords
+ 'gimp-mode
+'(("[A-Z-]\\{3,\\}" . font-lock-constant-face)) )
+
;;;; Globals
(defconst gimp-email-regexp
"\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]\\{2,4\\}\\b")
@@ -556,6 +561,14 @@ Raise error if ITEM is not in the RING."
(define-key m "\C-cc" 'gimp-toggle-completion)
(define-key m [mouse-1] 'gimp-insert-input)
(define-key m [mouse-2] 'gimp-insert-input)
+ (if (featurep 'fud)
+ (define-key m [(down-mouse-3)]
+ (lambda ()
+ "Set a fud breakpoint."
+ (interactive)
+ (let ((event (read-event)))
+ (mouse-set-point event)
+ (fud-set-breakpoint)))))
m))
(defvar gimp-mode-map
@@ -575,6 +588,14 @@ Raise error if ITEM is not in the RING."
(define-key m "\C-cr" 'gimp-toggle-fuzzy-completion)
(define-key m "\C-cc" 'gimp-toggle-completion)
(define-key m "\M-\\" 'comint-dynamic-complete-filename)
+ (if (featurep 'fud)
+ (define-key m [(down-mouse-3)]
+ (lambda ()
+ "Set a fud breakpoint."
+ (interactive)
+ (let ((event (read-event)))
+ (mouse-set-point event)
+ (fud-set-breakpoint)))))
m))
(defvar gimp-help-mode-map
@@ -602,7 +623,6 @@ Raise error if ITEM is not in the RING."
(define-key m "i" 'gimp-insert-sexp-at-repl)
(define-key m "t" 'outline-toggle-children)
(define-key m "S" 'gimp-selector)
- (define-key m "R" 'gimp-help-refresh)
(define-key m "\C-cf" 'gimp-describe-procedure)
(define-key m "\C-ca" 'gimp-apropos)
(define-key m "\C-ch" 'gimp-help)
@@ -696,7 +716,10 @@ buffer."
(add-to-list 'mode-line-process gimp-mode-line-format t)
(setq indent-line-function 'lisp-indent-line)
(if (null gimp-oblist-cache)
- (gimp-restore-caches)))
+ (gimp-restore-caches))
+ (setf ;turn off CASE-FOLD in
+ ;font-lock search
+ (caddr font-lock-defaults) nil))
(define-derived-mode inferior-gimp-mode inferior-scheme-mode
"Inferior GIMP"
@@ -713,7 +736,7 @@ buffer."
(destructuring-bind (version major minor)
(gimp-string-match
"\\([0-9]+\\)\.\\([0-9]+\\)"
- "$Id: gimp-mode.el,v 1.45 2008-07-29 07:58:39 sharik Exp $" )
+ "$Id: gimp-mode.el,v 1.46 2008-08-01 17:38:06 sharik Exp $" )
(if (interactive-p)
(prog1 nil
(message "GIMP mode version: %s.%s" major minor))
@@ -731,6 +754,11 @@ buffer."
(when (interactive-p)
(message "GIMP version: %s" version))
(list version major minor rev)))
+
+(defun gimp-check-version-compatibility ()
+ (let ((m (string-match "\\([0-9]\.[0-9]\\)\\(\.exe\\)?$" gimp-program)))
+ (when (and m (not (string-match (concat (match-string 1 gimp-program) "$") gimp-dir)))
+ (message "Version of `gimp-program' and `gimp-dir' do not match, this is probably an error, please correct"))))
;;;; Evaluation
(defmacro in-gimp (body)
"Evaluate fu sexps without having to quote them. Syntactic sugar.
@@ -766,6 +794,12 @@ make a vector in SCHEME with `in-gimp'.
(defun gimp-comint-filter (proc string)
(gimp-filter proc string)
+ (when (featurep 'fud)
+ (fud-find-reference string))
+
+ (when (featurep 'fud)
+ (fud-echo-value string))
+
(comint-output-filter
proc
(let ((string
@@ -802,6 +836,8 @@ When optional argument NEWLINE is non-nil, append a newline char."
(defun gimp-send-last-sexp (&optional insert)
"Send the previous sexp to the inferior Scheme process."
(interactive "P")
+ (if (featurep 'fud)
+ (fud-update-breakpoints))
(let ((result
(gimp-eval-to-string
(buffer-substring-no-properties
@@ -1027,32 +1063,53 @@ Deletes any previous stuff at that REPL"
;;;; Stuff pertaining to running 'n' quitting
;;;###autoload
-(defun run-gimp ()
- "Start the GIMP and its REPL."
- (interactive)
- (if (buffer-live-p (gimp-buffer))
- (if (gimp-buffer-window (gimp-buffer))
- (select-window (gimp-buffer-window (gimp-buffer)))
- (switch-to-buffer-other-window (gimp-buffer)))
- (if (eq window-system 'w32)
- (message "Probably no interaction possible here,\
+(defun run-gimp (override-p)
+ "Start the GIMP and its REPL.
+
+With prefix argument OVERRIDE-P, prompt for executable and
+arguments."
+ (interactive "P")
+ (let ((gimp-program
+ (if override-p
+ (read-file-name "Gimp executable: " "/" nil t gimp-program)
+ gimp-program))
+ (gimp-command-line-args
+ (if override-p
+ (read-from-minibuffer "Run with arguments: " gimp-command-line-args)
+ gimp-command-line-args)))
+ (if override-p
+ (let ((configuration-dir
+ (read-directory-name
+ "Gimp configuration directory (shall be set for this Emacs session): " "~/" nil t gimp-dir)))
+ (customize-set-variable 'gimp-dir (expand-file-name configuration-dir))
+ (if (not (file-exists-p (expand-file-name
+ (concat gimp-dir "/scripts/emacs-interaction.scm"))))
+ (if (y-or-n-p "Gimp-mode was not installed in that directory, install it there? ")
+ (gimp-install gimp-dir)
+ (error "Backing out")))))
+ (if (buffer-live-p (gimp-buffer))
+ (if (gimp-buffer-window (gimp-buffer))
+ (select-window (gimp-buffer-window (gimp-buffer)))
+ (switch-to-buffer-other-window (gimp-buffer)))
+ (if (eq window-system 'w32)
+ (message "Probably no interaction possible here,\
see `gimp-cl-connect' to connect as a client to the GIMP script-fu server"))
- (run-scheme (concat gimp-program " " gimp-command-line-args))
- (set-process-sentinel
- (gimp-proc)
- (lambda (p s)
- (if (string-match "finished" s)
- (error "Probably the GIMP is already running.
+ (run-scheme (concat gimp-program " " gimp-command-line-args))
+ (set-process-sentinel
+ (gimp-proc)
+ (lambda (p s)
+ (if (string-match "finished" s)
+ (error "Probably the GIMP is already running.
Either close that instance, add the -e switch to `gimp-command-line-args',
or run command `gimp-cl-connect'.")
- (message s))))
- (save-window-excursion
- (switch-to-buffer (gimp-buffer))
- (setq buffer-read-only t))
- (set-process-filter
- (gimp-proc)
- 'gimp-first-run-action)))
+ (message s))))
+ (save-window-excursion
+ (switch-to-buffer (gimp-buffer))
+ (setq buffer-read-only t))
+ (set-process-filter
+ (gimp-proc)
+ 'gimp-first-run-action))))
(defun gimp-first-run-action (proc string)
(set-process-sentinel
@@ -1120,6 +1177,21 @@ Optional argument END-TEXT is the text appended to the message when TEST fails."
(when proc
(process-buffer (gimp-proc)))))
+(defun gimp-latest-source-buffer ()
+ "Return latest visited source buffer.
+
+Return nil if none or only one, being the current
+buffer, is found."
+ (let* ((this-buffer (current-buffer))
+ (buffer (car
+ (member-if
+ (lambda (b)
+ (with-current-buffer b
+ (and (eq major-mode 'gimp-mode)
+ (not (eq b this-buffer)))))
+ (buffer-list)))))
+ buffer))
+
(defun gimp-dir ()
(if (not (gimp-interactive-p))
gimp-dir
@@ -1212,11 +1284,50 @@ Optional argument END-TEXT is the text appended to the message when TEST fails."
(if
(or
(= (or (char-after (1- (point))) 0) ?\")
- (bobp)) ;or at beginning of buffer
+ (bobp)
+ (< 47 (char-after))
+;or at beginning of buffer
nil
(gimp-current-symbol))
(goto-char p))))))
+(defun gimp-fnsym-in-current-sexp ()
+ (let ((p (point)))
+ (when (not (looking-back ",[[:alnum:]- ]+"))
+ (with-syntax-table scheme-mode-syntax-table
+ (while
+ (and
+ (not (bobp))
+ (let ((m (when (gimp-proc)
+ (process-mark (gimp-proc)))))
+ (or (not m)
+ (if
+ (eq (marker-buffer m)
+ (current-buffer))
+ (not (= (point)
+ (marker-position m)))
+ t))) ;no rules for other types of buffers.
+ (or
+ (when (eq (char-syntax (char-before)) ?\")
+ (backward-sexp 1)
+ t)
+ (memq (char-syntax (char-before)) '(?w ?_ 32 ?- ?\" ?> ?'))
+ (when (memq (char-syntax (char-before)) '(?\)))
+ (backward-sexp 1)
+ t)))
+ (forward-char -1)))
+ (prog1
+ ;; Return nil if current word is actually:
+ (if
+ (or
+ (= (or (char-after (1- (point))) 0) ?\") ;at a string
+ (bobp) ;or at beginning of buffer
+ (number-at-point)) ;or beginning with a number -
+ ;hence no symbol.
+ nil
+ (gimp-current-symbol))
+ (goto-char p)))))
+
(defun gimp-position ()
"Return position of point in current lambda form."
(if (bolp) ;correct, but does not intercept all possible
@@ -1905,7 +2016,8 @@ You can toggle this variable at any time with the command
gimp-brushes-cache))
((lambda (desc name type)
- (string-match "palette" desc))
+ (or (string-match "palette" desc)
+ (string= type "GIMP_PDB_PALETTE")))
. (lambda (&rest ignore)
gimp-palettes-cache))
@@ -2293,6 +2405,12 @@ Optional argument TERSE means only show that I am there to help you."
(point))))
(error "Not in *GIMP* buffer")))
+(gimp-defcommand gimp-clear ()
+ "Clear REPL"
+ (interactive)
+ (erase-buffer)
+ (comint-send-string (gimp-proc) "(begin (display \"Display \") 'cleared)\n"))
+
(defun gimp-make-input-field (arg)
(gimp-button arg input
(gimp-string-match
@@ -2336,17 +2454,16 @@ argument at point is highlighted."
(and (not (interactive-p))
(not gimp-echo-p)))
(let ((result))
- (catch 'a
- (let* ((sym (or sym (gimp-fnsym-in-current-sexp)))
+ (let* ((sym (or sym (gimp-fnsym-in-current-sexp)))
(str (symbol-name sym))
- cache-resp
+ response
(pos (gimp-position)))
(cond ((gethash sym gimp-dump)
;; Get it
- (setq cache-resp
+ (setq response
(gimp-docstring (read str))))
- ((unless nil;(string-match "define\\(?:-macro\\)?\\|let" str)
+ ((unless nil ;(string-match "define\\(?:-macro\\)?\\|let" str)
;`scheme-get-current-symbol-info'
;"fails" in these cases.
(let
@@ -2355,44 +2472,44 @@ argument at point is highlighted."
(if (and info (listp (read info))) ;the actual condition
;for cond clause
(progn
- (setq cache-resp (read info))
+ (setq response (read info))
(setq result (gimp-string-match "(.*)\\(.*\\)" info 1))
t) ;break
nil))))
(t
;; Get it (unless we have it already)
- (unless cache-resp
- (setq cache-resp
+ (unless response
+ (setq response
(if gimp-try-and-get-closure-code-p
(gimp-get-closure-code sym)))
- (when (not (consp cache-resp))
- (setq cache-resp nil)))))
-
- (when (and cache-resp
- (not (eq 'gimp-error (car cache-resp)))) ;this may be
- ;an error
- ;in gimp-cl
- (setq cache-resp
+ (when (not (consp response))
+ (setq response nil)))))
+
+ (when (and response
+ (not (eq 'gimp-error (car response)))) ;this may be
+ ;an error
+ ;in gimp-cl
+ (setq response
(mapcar (lambda (item) (format "%s" item))
- (dotted-to-list cache-resp)))
- (setf (car cache-resp)
+ (dotted-to-list response)))
+ (setf (car response)
(propertize str 'face 'font-lock-keyword-face))
;; Show it
- (let ((this-arg (nth pos cache-resp)))
+ (let ((this-arg (nth pos response)))
(when this-arg
(when (> pos 0)
- (let ((arg (nth pos cache-resp)))
- (setf (nth pos cache-resp)
+ (let ((arg (nth pos response)))
+ (setf (nth pos response)
(if (string-match "^\. " arg)
(concat ". "
(propertize (substring arg 2)
'face 'highlight))
(propertize arg 'face 'highlight)))))
- (message "(%s)%s" (mapconcat 'identity cache-resp " ")
+ (message "(%s)%s" (mapconcat 'identity response " ")
(or result ""))
(when (> pos 0)
(set-text-properties 0 (length this-arg)
- nil (nth pos cache-resp)))))))))))
+ nil (nth pos response))))))))))
(defun gimp-echo-procedure-description (sym)
"Echo short description for SYM."
@@ -2564,15 +2681,7 @@ Type the abbreviations on the left in a GIMP Mode buffer, and hit ENTER
Argument CHAR is used to choose between buffers.'."
(interactive "cSwitch to gimp buffer [rldhc?]: ")
(case char
- (?l (let ((buffer (car
- (member-if
- (lambda (b)
- (with-current-buffer b
- (eq major-mode 'gimp-mode)))
- (buffer-list)))))
- (if buffer
- (switch-to-buffer buffer)
- (error "No living gimp-mode buffers to switch to"))))
+ (?l (call-interactively 'gimp-switch-to-latest-source-buffer))
(?h (gimp-help))
(?r (call-interactively 'run-gimp))
(?c (if (eq (process-status gimp-cl-proc) 'open)
@@ -2586,6 +2695,15 @@ Argument CHAR is used to choose between buffers.'."
(call-interactively 'gimp-selector))
(t (call-interactively 'gimp-selector))))
+(defun gimp-switch-to-latest-source-buffer ()
+ "Switch to the latest source buffer in gimp-mode.
+If none is found, display a message stating so."
+ (interactive)
+ (let ((buffer (gimp-latest-source-buffer)))
+ (if buffer
+ (switch-to-buffer buffer)
+ (message "No (other) living gimp-mode buffers to switch to."))))
+
(gimp-defcommand gimp-load-script (&optional script)
"Load a SCRIPT into the scheme image."
(interactive)
@@ -2851,6 +2969,8 @@ Lisp world."
(comint-send-input)))))
(gimp-command (message "No such command: %s" gimp-command))
(t
+ (if (fboundp 'fud-update-breakpoints)
+ (fud-update-breakpoints))
(let ((undo-list (if (listp buffer-undo-list)
buffer-undo-list
nil)))

0 comments on commit c107a2b

Please sign in to comment.