/* * Add Encoding Decl to All Buffers.bsh - BeanShell macro to add standard * encoding declaration to python source files * * Copyright (C) 2009 Giacomo Lacava g.lacava@gmail.com * * :mode=beanshell:tabSize=3:indentSize=3:maxLineLen=0:noTabs=true: * :indentOnTab=true:indentOnEnter=true:folding=explicit:collapseFolds=1: * * {{{ License * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the jEdit program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * }}} * * This macro will get all the open buffers and prepend them with a * PEP263-compliant encoding declaration. The buffers will NOT be saved, use * Files -> Save All for that. * * */ String encLine1 = new String("# -*- coding: "); String encLine2 = new String(" -*-\n"); buffers = jEdit.getBuffers(); for(i = 0; i < buffers.length; ++i) { buffers[i].insert(0,encLine1 + buffers[i].getStringProperty("encoding").toLowerCase() + encLine2); }