Hi

One of the feature I miss most is to insert the result of
matlab-shell-run-command in the matlab buffer.

The following code cleans up that result and inserts it in the buffer.

I have a different version which also wraps
\begin{displaymath}
\end{displaymath}

Around it.

The funny thing is that I wrote this function for Xemacs but in GNU
emacs ;
(string-rectangle (point-min) (point-max) "% ")
behaves differently, it inserts the "% " but deletes all the other
content!

So  I found a different solution using comment-region.

Any comments and improvements are very welcome.

Uwe Brauer 


(defun my-matlab-insert-simple-raw ()
  "Change and insert the content of the *Matlab Help* buffer.
  (Sometimes invoked with `matlab-shell-run-command'.)
`kill-empty-lines' put all results in one line, and `comment'
them out according to the `matlab' syntax."
  (interactive)
  (save-excursion
        (let   ((currentname  (current-buffer)))
          (switch-to-buffer "*MATLAB Help*")
          (make-variable-buffer-local 'comment-start)
          (setq comment-start "%")
          (toggle-read-only nil)
          (goto-char (point-min))
          (delete-empty-lines-region (point-min) (point-max))
          (goto-char (point-max))
          (delete-backward-char 1 nil)
          (goto-char (point-min))
          (while (re-search-forward  "=" nil t)
          (kill-line nil))
          (goto-char (point-min))
          (comment-region (point-min) (point-max) nil)
;         (string-rectangle (point-min) (point-max) "% ")
          (switch-to-buffer currentname)
          (insert-buffer "*MATLAB Help*"))))

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to