Why does this script-fu not work? - lisp

(define (script-fu-create-camo image colA colB))
(script-fu-register
"script-fu-create-camo"
"Camoflauge"
"Creates a camoflauge pattern on an image"
"Jeffrey Aylesworth <jeffrey#aylesworth"
"Copyright (c) 2009 Jeffrey Aylesworth"
"2009/12/31"
""
SF-IMAGE "Image" 0
SF-COLOR "Colour 1" '(50 0 0)
SF-COLOR "Colour 2" '(0 50 0))
(script-fu-menu-register "script-fu-create-camo" "<Image>/Filters/Render")
I am using Gimp 2.6 on Mac OS 10.6. The script is saved as ~/gimp-2.6/scripts/camoflauge.scm, the script does not create a new item in the menu. What am I doing wrong?

I created a few script-fu scripts which I used on my mac. I always placed them in:
/Applications/Gimp.app/Content/Resources/share/Gimp/2.0/scripts/
And on my register I would prepend the "<Image>/Filters/Render" with an underscore, so _"<Image>/Filters/Render"
Hope this helps, been a while since I was messing with this.

Related

How can I stop org mode from moving my figures to the last page?

I'm currently trying to write up my thesis in emacs org-mode, and have run into some problems with file inclusions.
When I include figures with:
#+NAME: fig:banana
#+CAPTION: this is a figure caption
[[/path/to/image.png]]
(or using a pdf) it works fine. But when I insert another image, it is somehow moved to the end of the file instead of being inserted where it is called.
My pdf-export process (in my ~/.emacs file) looks like this:
(setq org-latex-pdf-process
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
Any ideas on how to fix this?
A friend of mine pointed me to the LaTex package placeins.
#+LATEX_HEADER: \usepackage{placeins}
* section 1
** hi!
#+TITLE: fig:banana
#+CAPTION: this is a banana figure
[[/link/to/banana.png]]
\FloatBarrier
* section 2
The FloatBarrier stops floats (figures are floats) from jumping over them. I will need to look into passing [tbh] options to figures from org mode further.
Check the org-mode manual on how to pass placement options such as [h], [t] etc. to theLaTeX compiler.
If you're not sure how to control where figures (more precisely, floats) get placed by LaTeX, please refer to any introduction.
Or do you want the figure to be placed where you include it? If so, you might not need it to be a float.

Org-mode & Latex export: Any way to put short & long names in sectioning commands? Workarounds?

In standard Latex, one can use something like...
\section[short head]{A longer and more meaningful heading version for the section}
...that gives both a long and short version of a section (or other sectioning command) Thus, allowing for both meaningful sectioning 'titles' and, also, reasonable-looking running heads, TOCs, beamer navigation, etc..
Is there any way to easily achieve this in org mode? (That is without hard coding the sectioning commands in LATEX snippets and, thus, defeating most of the flexibility of changing sectioning levels and repurposing content for beamer, book, and article classes that is my reason for wanting to try orgmode, in first place?)
I tried a "workaround" that did not work. I tried editing the possible latex export classes by adding another class to org-export-latex-classes. This new class changes sectioning commands from \section{%s} to \section%s(EDIT-Fixed typo in slashes). Then I tested using [short]{longer version} in orgmode sections of the file. It worked, except it acted as if the longer version section heading was just "{" and "longer version" was body text! What is up with that?
Since version 8.0 the "org-export-latex-classes" strategy won't work anymore.
Instead, and dare I say much more elegantly, you can set the ALT_TITLE property for the heading.
See http://orgmode.org/manual/Table-of-contents.html.
The following org code:
* The Long Title of Section 1
:PROPERTIES:
:ALT_TITLE: Section 1
:END:
Lorem ipsum.
** The Long Title of Subsection 1-1
:PROPERTIES:
:ALT_TITLE: Subsection 1-1
:END:
Dolor sit amet.
will export to LaTeX as:
[...]
\section[Section 1]{The Long Title of Section 1}
\label{sec-1}
Lorem ipsum.
\subsection[Subsection 1-1]{The Long Title of Subsection 1-1}
\label{sec-1-1}
Dolor sit amet.
You had the right idea with creating your own LaTeX class. The problem lies with the way the templates are filled by the default org-fill-template function. I'm not so great with Lisp, but this this hack will do the trick. Add the following to your .emacs file:
(defun my-section (level text)
(let* ((in "") (out "")
(short-title (if (string-match "\\[.*\\]" text)
(substring text (match-beginning 0)
(match-end 0))
nil)))
(if short-title (setq text (substring text (match-end 0) -1)))
(setq in (org-fill-template
"\\section%S{%s}"
(list (cons "S" (or short-title ""))
(cons "s" (or text ""))))
out (copy-sequence "\\end{section}"))
(cons text (list in out in out))))
(add-to-list 'org-export-latex-classes
'("test"
"\\documentclass{article}"
my-section))
This declares a new latex class by adding a "test" class to the org-export-latex-classes. Here we declare, instead of the normal \\section{%s} stuff a function that takes two parameters --- the current level and the headline text --- and returns a modified cons cell. Some details of this information can be found in org-latex-export.el.
Above the adding to the list is where we actually define the function. This is honestly a hacky version, and I pulled a lot from the org-beamer-sectioning function in org-beamer.el file. This function basically searches the headline for anything that is like a LaTeX short label (i.e. [....]) removes it from the headline and sticks it before the actual section label. Right now this hack will only generate \section statements, no matter how deep the level - if you want something more intelligent like \chapter or \subsection or even unnumbered items, you'll need to do some more Lisping; again, see org-beamer.el for some help.
This bit of org-mode code
#+latex_class: test
* [short 1] this is 1 star
test
** this is a 2 star
test
*** [short 3] this is a 3 star
test
**** what happens
exports to LaTeX as (only relevant sections shown here):
\section[short 1]{ this is 1 star}
\label{sec-1}
test
\section{ this is a 2 star }
\label{sec-1-1}
test
\section[short 3]{ this is a 3 star}
\label{sec-1-1-1}
test
\section{ what happens }
\label{sec-1-1-1-1}
\end{section}
\end{section}
\end{section}
\end{section}
Although it's not a straight org-mode solution, it seems to work and can be a starting point for you. One of these days I might try to write it up properly and get it folded into the org-mode distribution.
It is possible to use the following commands in latex to define the text that should appear in the header to replace section names. But the TOC will still contain the original names.
\chaptermarks
\sectionmarks
\subsectionmarks
...
So, in org-mode you can write
* Long section title
#+LaTeX: \sectionmark{Short title}
edit: it actually doesn't work on the very page where the section name appears. On this one only, the full name is still put in the header.

Netbeans 7.0.1 Word Wrap

I know there are a bunch of posts about this already, stackoverflow: word wrap in netbeans, for one, and there are some people that say it is already included in netbeans 7, but for the most part they are all old, or inconclusive. I use netbeans 7.0.1 and the included word wrap is half-assed and glitchy at best. Going to Tools > Options > Editor > Formatting > Line Wrap and setting it to either "After Words" or "Anywhere" both result in practically the same sort of wrapping and neither one is very reliable. On occasions it will wrap as expected, but more often than not you can end up with anywhere from one word to an entire paragraph past the vertical scrollbar. Is there something I am missing or is that really the way that's supposed to work?
I'm still looking and will post any significant finds, but does anyone know of a way to fix this, or a plugin to install for it, or anything? I would have figured after 4 years of inquiries (2008 is the oldest post I've found about this) netbeans would have fixed it :(
BTW: Not looking for reasons why my code shouldn't be more than 80 character long, there's no helping it sometimes and that answer isn't helpful. I have also tried adding "-J-Dorg.netbeans.editor.linewrap=true" in the netbeans.conf file, but from what I gather that is for enabling the feature in older version and did nothing in mine (I removed it).
On Netbeans 7 and 8, you can use Tools/Options/Editor/Formatting/LineWrap.
It can only be globally enabled.
you can do it from:
1) Tools -> Options -> Editor -> Formatting(Tab)
2) Select Your Language in "Language Drop down"
3) Select "Wrapping" from "Category and do what ever you want
Note: this is for Windows OS
I have done it in netbeans 8.0
Goto -> Tools-> options-> Editor-> Formatting-> language(dropdown-All languages) -> Category(dropdown-Tabs and indents) -> Line wrap(After word)
Make sure you re-open the file to see the change.
In case any one is looking for this with NetBeans 8 on OSX and ends up here, it's preferences/Options/Editor/Formatting/LineWrap
you can do it from:
1) Tools -> Options -> Editor -> Formatting(Tab)
2) Select Your Language in "Language Drop down"
3) Select "Tabs and Indents" from "Category
4) Dropdown" select any of the desired option from "Line Wrap drop down"
i.e After words or Anywhere
Note: this is for Windows OS
In Netbeans 7.2 it's actually, "Wrapping" instead of "Line Wrapping" and it's "If Long" instead of "After Words", but that probably doesn't answer your question.
You posted this almost one year ago, and you still haven't found anything yet?
I don't like how they decide to wrap by way of creating actual new lines in the editor. I would prefer if it just line-wrapped but you didn't have to make a new line - like, what you have with Notepad. However, I would prefer if you had a symbol to show that you're line wrapping on the next line, like I have seen in other IDE's before.
I done in Netbeans 8.0.2 as following way :
NetBeans->preferences/Options/Editor/Formatting/LineWrap
Hope this is useful.

Color discrepancy between Emacs 22 and Emacs 23

If .emacs contains the following two lines
(set-face-foreground 'modeline "#000000")
(set-face-background 'modeline "#00FFFF")
then Emacs 22 correctly uses color #00FFFF (cyan), but Emacs 23
uses a different shade of blue (#90FBFE).
What is happening?
An image will illustrate the problem, but because I'm a new user here, stackoverflow will not let me save an image.
In the meantime, here is the image hosted elsewhere:
http://postimage.org/image/1j2ya1ddw/
Version 23 on OS X uses the new Cocoa front-end, and the colors are rendered incorrectly both in that version and in the current dev Emacs. I opened a bug for this last week, having been working on a color theme using precisely-selected colors, and the developers appear to be in the process of accepting the bug's validity.
For me this two lines do their job, but if I set an alpha parameter of
a selected frame then colors change similar. I've looked at the
emacs 22.3 manual and found nothing about the alpha parameter. But if
you look at the 23.3 manual you could find this phrase in the `alpha'
parameter section:
It can also have a `nil' value, which
tells Emacs not to set the frame
opacity (leaving it to the window
manager).
Maybe your window manager changes the colors of a frame? If it so this line of code can help you:
(set-frame-parameter (selected-frame) 'alpha 100)

Which .emacs -file would you give for a Vim veteran?

I have used Vim for coding.
I want to learn Emacs too.
I would like to export at least some of the following customizations in my .vimrc to my .emacs.
My .vimrc
let Tlist_Auto_Open = 1
" http://stackoverflow.com/questions/165231/vim-dvorak-keybindings-rebinding
" Dvorak it!
no d h
no h j
no t k
no n l
no s :
no S :
no j d
no J D
no l n
no L N
" Added benefits
no - $
no _ ^
no N
no ; z
no T L
no P P
no p p
let Tex_ViewRuleComplete_pdf = '/usr/bin/open -a Skim $*.pdf'
set history=1000
set smartindent
set autoindent
set tabstop=4
set expandtab
set shiftwidth=3
set softtabstop=4
set number
set hlsearch
syntax on
set cursorline
highlight CursorLine guibg=#400000
set ruler
set textwidth=78
set foldcolumn=5
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
filetype indent on
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: This enables automatic indentation as you type.
filetype indent on
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
" http://ubuntuforums.org/showthread.php?t=74889
set foldmethod=manual "folds by indentation, manual, indent
set nocompatible "Use Vim extensions
set backspace=indent,eol,start "More powerful backspacing
set nobackup "No backup file
set showmode "Tell when in insert mode
set showmatch "Show matching () {} etc
set hlsearch "Highlight what is searched for
set incsearch "Highlight as you type
if &t_Co > 2
syntax on
endif
set bg=dark
hi clear
if exists("syntax_on")
syntax reset
endif
"Allowable colors: red, yellow, green, blue, magenta,
" cyan, gray, black, gray
hi Normal ctermfg=gray ctermbg=none
hi ErrorMsg ctermfg=gray ctermbg=lightblue
hi Visual ctermfg=lightblue ctermbg=fg cterm=reverse
hi VisualNOS ctermfg=lightblue ctermbg=fg cterm=reverse,underline
hi Todo ctermfg=red ctermbg=darkblue
hi Search ctermfg=gray ctermbg=darkblue
hi IncSearch ctermfg=darkblue ctermbg=gray
hi SpecialKey ctermfg=darkcyan
hi Directory ctermfg=cyan
hi Title ctermfg=magenta cterm=bold
hi WarningMsg ctermfg=red
hi WildMenu ctermfg=yellow ctermbg=black cterm=none
hi ModeMsg ctermfg=lightblue
hi MoreMsg ctermfg=darkgreen ctermfg=darkgreen
hi Question ctermfg=green cterm=none
hi NonText ctermfg=darkblue
hi StatusLine ctermfg=blue ctermbg=gray cterm=none
hi StatusLineNC ctermfg=black ctermbg=gray cterm=none
hi VertSplit ctermfg=black ctermbg=gray cterm=none
"hi Folded ctermfg=darkgrey ctermbg=black cterm=bold
"hi FoldColumn ctermfg=darkgrey ctermbg=black cterm=bold
hi LineNr ctermfg=gray cterm=none
hi DiffAdd ctermbg=darkblue cterm=none
hi DiffChange ctermbg=magenta cterm=none
hi DiffDelete ctermfg=blue ctermbg=cyan
hi DiffText cterm=bold ctermbg=red
hi Cursor ctermbg=brown
hi lCursor ctermbg=darkgreen
hi Comment ctermfg=lightgreen cterm=none
hi Constant ctermfg=cyan cterm=none
hi Identifier ctermfg=gray cterm=none
hi Statement ctermfg=red cterm=none
hi PreProc ctermfg=yellow cterm=bold
hi Type ctermfg=darkyellow cterm=none
hi Special ctermfg=magenta cterm=none
hi Underlined cterm=underline
hi Ignore cterm=none
What is in your .emacs which would allow me to have some of the above features?
The EMACS Starter Kit is helpful too.
My God -- you really remap your keyboard to Dvorak in your .vim?
Okay, here are some of the others:
set smartindent
set autoindent
There automagically in programming modes. For text modes, look at 'autoindent-mode" and "filladapt."
set tabstop=4
set shiftwidth=3
set softtabstop=4
(setq c-basic-offset 4) ; indents 4 chars
(setq tab-width 4) ; and 4 char wide for TAB
(setq indent-tabs-mode nil) ; And force use of spaces
(There's no easy equivalent for shiftwidth; EMACS uses a smarter autindentation algorithm.
set expandtab
(setq indent-tabs-mode nil)
set number
There is a way to get numbered lines, but I never use it and don't remember it.
syntax on
(turn-on-font-lock)
set cursorline
There are a pile of cursor settings, look through M-x apropos cursor
Some of the other stuff is also available, these are the things I know of offhand.
Try these, and experiment.
dotfiles emacs
dotfiles.org
Apart from those, always a nice link:
GNU Emacs Manuals Online
You can get numbered lines with (linum-mode 1) or (global-linum-mode 1) for every buffer. This feature is currently only in the CVS Emacs. See further choices.
For opening PDF documents inside Emacs, there is doc-view-mode. See View PDF/PS/DVI files in an Emacs buffer for further instructions.
Anyway, it'd better if you start up learning Emacs with Emacs Starter Kit as Charlie Martin suggested, and then find yourself what you're really missing. Emacs world is different than Vi's. And you can always browse Stack Overflow to find if your question was already answered.
you definitely should try evil-mode. Best vim emulator for emacs:
http://www.emacswiki.org/emacs/Evil