Permalink
Browse files

Merge branch 'master' of git://github.com/pft/gimpmode

  • Loading branch information...
2 parents a130126 + 8901c33 commit f8fa46ebd96d7a471f4dd46a2976ccc89a46c778 niels giesen committed May 19, 2010
Showing with 34 additions and 5 deletions.
  1. +2 −0 .gitignore
  2. +26 −4 HISTORY
  3. +6 −1 gimp-mode.el
View
@@ -0,0 +1,2 @@
+*.elc
+/gimp-vars.el
View
@@ -1,4 +1,20 @@
-;; ooh, how convolved this is...
+;; -*- mode: Gimp; -*-
+
+;;; This file describes the history of various parts of Gimp Mode.
+
+;;;; 1. History of `emacs-cl-output' macro.
+
+;; The problems this macro solves is twofold: first, the
+;; script-fu-server in GIMP does not print the return value after
+;; evaluation. Second, the evaluation is not part of the running
+;; scheme image. This macro will write back the evaluation to a file,
+;; to be read both by Emacs and GIMP itself.
+
+;; Note that the problem of not returning the result of evaluation is
+;; addressed in https://bugzilla.gnome.org/show_bug.cgi?id=583778,
+;; with a working patch available and planned for taking a look at
+;; with version 2.8.
+
;; First try: make sure define'd stuff is loaded into the image
;; Major defect: double evaluation.
(define-macro (emacs-cl-output . body)
@@ -49,14 +65,20 @@
(with-output-to-emacs-file ,input-file
(write
'(set! *emacs-cl-output* ,@body))
- (display "\n") ;apparently, any sexp at
+ (newline) ;apparently, any sexp at
;top-level needs some distance
;for the reader
(write '(with-output-to-emacs-file
,output-file
(write *emacs-cl-output*)))
- (display "\n"))
+ (newline))
(load ,(make-emacs-file input-file)))))
-;; Seeing how involved this process is,
+;; Concluding: we let GIMP write two forms into a file. The fist form
+;; is to evaluate the initial input and put the result in a temporary
+;; variable (called `*emacs-cl-output*'). The second form is to write
+;; back this evaluation into a file to be read by Emacs.
+
+;; After that, GIMP loads the file, and thereby loads the initial
+;; input just once, leaving a file for Emacs to read the result from.
View
@@ -1225,7 +1225,12 @@ Optional argument END-TEXT is the text appended to the message when TEST fails."
(setq last-char 45))
(message "%s%c" (substring mess 0 (1- (length mess)))
(ring-next r last-char))
- (sit-for .15)))
+ ;; Discard any terminal input if sit-for returned immediately, thus forcing
+ ;; the gimp-filter function to get called with any new pending process
+ ;; input. What effect this has on the C-g quiting aspect is not known
+ ;; at this point:
+ (if (not (sit-for .15))
+ (discard-input))))
(if end-text (message "%s%s" (current-message) end-text))))
(defalias 'gimp-start 'run-gimp

0 comments on commit f8fa46e

Please sign in to comment.