Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplified the image viewing function

  • Loading branch information...
commit e60e497f84a310814ccf97b056da77dd0f42394f 1 parent e8836bd
Marco authored

Showing 1 changed file with 14 additions and 24 deletions. Show diff stats Hide diff stats

  1. 38  pov-mode.el
38  pov-mode.el
@@ -402,8 +402,8 @@
402 402
 (defvar pov-default-view-internal)
403 403
 (defvar pov-image-file)
404 404
 (defvar pov-default-image-extension)
405  
-(defvar rendericon)
406  
-(defvar viewicon)
  405
+(defvar pov-rendericon)
  406
+(defvar pov-viewicon)
407 407
 (defvar pov-documentation-directory)
408 408
 (defvar pov-documentation-keyword-index)
409 409
 (defvar pov-documentation-index)
@@ -1613,9 +1613,9 @@ character number of the character following `begin' or START if not found."
1613 1613
   (save-excursion
1614 1614
     (let ((pov-completion-all nil))
1615 1615
       (pov-get-scope)
1616  
-      (mapc '(lambda (s)
1617  
-		 (if (string-match (concat "\\<" pov-completion-str) s)
1618  
-		     (setq pov-completion-all (cons s pov-completion-all))))
  1616
+      (mapc #'(lambda (s)
  1617
+	       (if (string-match (concat "\\<" pov-completion-str) s)
  1618
+		   (setq pov-completion-all (cons s pov-completion-all))))
1619 1619
 	      pov-completion-list)
1620 1620
       ;; Now we have built a list of all matches. Give response to caller
1621 1621
       (pov-completion-response))))
@@ -1665,7 +1665,7 @@ character number of the character following `begin' or START if not found."
1665 1665
 	 ;(pov-buffer-to-use (current-buffer))
1666 1666
 	 (allcomp (all-completions pov-completion-str 'pov-completion))
1667 1667
 	 (match (try-completion
1668  
-		 pov-completion-str (mapcar '(lambda (elm)
  1668
+		 pov-completion-str (mapcar #'(lambda (elm)
1669 1669
 					       (cons elm 0)) allcomp))))
1670 1670
     ;; Delete old string
1671 1671
     (delete-region b e)
@@ -1831,17 +1831,17 @@ without questions"
1831 1831
       ;; tool-bar entries for GNU Emacs
1832 1832
       (if (and font-pov-is-Emacs (image-type-available-p 'xpm))
1833 1833
 	  (progn 
1834  
-	    (setq viewicon (concat pov-icons-location "povview.xpm")
1835  
-		  rendericon (concat pov-icons-location "povrender.xpm"))
  1834
+	    (setq pov-viewicon (concat pov-icons-location "povview.xpm")
  1835
+		  pov-rendericon (concat pov-icons-location "povrender.xpm"))
1836 1836
 	    (define-key pov-mode-map [tool-bar  render] 
1837 1837
 	      ;;      '(menu-item "Render" pov-render-dialog
1838 1838
 	      `(menu-item "Render this file using the default quality" 
1839 1839
 			  pov-tool-bar-command-render
1840  
-			  :image ,(create-image rendericon )))
  1840
+			  :image ,(create-image pov-rendericon )))
1841 1841
 
1842 1842
 	    (define-key pov-mode-map [tool-bar view] 
1843 1843
 	      `(menu-item "Preview"   pov-tool-bar-command-view
1844  
-			  :image ,(create-image viewicon)))))))
  1844
+			  :image ,(create-image pov-viewicon)))))))
1845 1845
   
1846 1846
 
1847 1847
 
@@ -2227,20 +2227,10 @@ filename of the output image (XXX with a horrible buffer-local-hack...)"
2227 2227
     (if (file-exists-p (pov-get-the-default-image-name))
2228 2228
 	(setq file (pov-get-the-default-image-name))
2229 2229
       (setq file
2230  
-	  (read-file-name "Which image file should I display? "))))
2231  
-  (let ((buffer (get-buffer-create
2232  
-		 (format "*Povray View %s*" file))))
2233  
-    (with-current-buffer buffer
2234  
-      (toggle-read-only -1)
2235  
-      (erase-buffer)
2236  
-      (if (and  font-pov-is-Emacs22 (image-type-available-p 'png)) ;; MP
2237  
-	  (progn (clear-image-cache) ;; really important!
2238  
-		 (insert "\n")
2239  
-		 (goto-char (point-max))
2240  
-		 (insert-image (create-image file) )
2241  
-		 (insert "              \n\nType C-x b to go back!") ;; avoid blinking cursor
2242  
-		 (goto-char  (- (point-max) 1))
2243  
-		 (switch-to-buffer (current-buffer)))))))
  2230
+	    (read-file-name "Which image file should I display? "))))
  2231
+  (if (and font-pov-is-Emacs22 (image-type-available-p 'png)) ;; MP
  2232
+      (find-file file)
  2233
+    (message "You can't visit a png file!")))
2244 2234
 
2245 2235
 
2246 2236
 

0 notes on commit e60e497

Please sign in to comment.
Something went wrong with that request. Please try again.