auto-indent in Sublime Text 2 with Erlang after -> - erlang

How to auto-indent in Sublime Text 2 with Erlang after -> ?
I found this page: http://sublimetext.userecho.com/topic/85708-fix-increaseindentpattern-for-erlang/
How to apply it?
Do I have to use some packages such as SublimErl?
Thanks!
Update:
Install Sublime-Erlang (https://github.com/fjl/Sublime-Erlang‎) and disable the Erlang package shipped with Sublime Text 2 is the most easy way.

If the want to apply the new pattern that you linked to, than edit this file:
~/Library/Application Support/Sublime Text 2/Packages/Erlang/Indentation Rules.tmPreferences
SublimeErl looks like a cool plugin. SublimeREPL also offers Erlang support.

Related

How to format/beautify rails erb code

How to format/beautify rails erb code. The view code is a mix of erb and JS.
I tried using the following tool as well, but it didn't help
https://github.com/katgironpe/rails-erb-lint
A good IDE to format/beautify rails is RubyMine.
RubyMine is able to reformat many types of files, like Ruby, HTML, JavaScript, CSS, etc.
example for reformat erb file:
Before:
After:
You can set the code style in the Preferences / Editor / Code Style
The tool which you already used, i.e., rails-erb-lint, checks only for the validity of you ERB and doesn't help with beautifying the ERB code. I don't know which editor you are using, but you can try either Sublime Text 3 or Github's Atom. Both of these have 3rd party packages to beautify Ruby and ERB code. Moreover, the indentation and trailing whitespace removing ability of these editors are enough to beautify/format the ERB files, though they have menu items/ shortcuts to do this on-demand/selectively too.
If you are using Sublime Text, check out this "Sublime Text 2 & 3 Plugin to BeautifyRuby":
https://github.com/CraigWilliams/BeautifyRuby
Once installed via Sublime's Package Control System you can use the shortcut ctrl + alt + k (on Windows + Linux) or ctrl + cmd + k (on OS X) to beautify your Ruby and erb-files manually - or configure the plugin to do that automatically before saving any Ruby- and erb-file. Configuration is easy - you find the config-file here (via the Sublime- menu):
Preferences > Package Settings > BeautifyRuby > Settings - Default:
{
// Specify your ruby interpreter (below). (Note, if you are using a linux distro with Rbenv instead of RVM, then try the following path: "ruby": "~/.rbenv/shims/ruby")
"ruby": "~/.rvm/bin/rvm-auto-ruby",
// Use 2 Spaces instead of tabs:
"translate_tabs_to_spaces": true,
"tab_size": 2,
// You can change the file patterns handled by this plugin:
"file_patterns": ["\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile", "Vagrantfile"],
"html_erb_patterns": ["\\.html\\.erb"],
// This package offers a pre-save hook; when activated, your ruby and erb files will
// be reformatted automatically before saving (deactivated by default)
"run_on_save": false,
// The sublime command "beautify_ruby" performs a save after formatting.
// (activated by default)
"save_on_beautify": false
}
BeautifyRuby depends on the Ruby gem htmlbeautifier, which needs to be installed on your system first. Otherwise the plugin throws an error each time you try to beautify your code. Make sure, the ruby-interpreter-setting in the config file shown above points to the correct ruby which holds the htmlbeautifier-gem...

How to change the editor styles for Dart eclipse plugin editor

I would like to change the style for the default look of the Dart-plugin editor in eclipse IDE. For example I would like to change the colour of comments from green (default) to pale gray. How can I accomplish this in the Dart eclipse plugin. I see how it is done for Java, JavaScript etc but none for Dart.
I found a way to change the theme manually (the Dart plug-in doesn't have any option to change it automatically, and doesn't support other plug-ins like Eclipse Color Theme).
Depending on your OS, these steps might be different, but this worked for me on Linux.
From your Eclipse workspace directory, go to .metadata/.plugins/org.eclipse.core.runtime/.settings. There is a file named com.google.dart.tools.ui.prefs; open it with your preferred text editor.
In my case, I wanted to use the "Dartboard" theme included in Dart Editor. I copy-pasted the following from the same file in the Dart Editor workspace directory (on my system, found in ~/.dartEditor/.metadata/.plugins/org.eclipse.core.runtime/.settings) :
content_assist_completion_replacement_background=250,250,250
content_assist_completion_replacement_foreground=0,0,0
content_assist_parameters_background=250,250,250
content_assist_parameters_foreground=0,0,0
content_assist_proposals_background=250,250,250
content_assist_proposals_foreground=0,0,0
dart_bracket=96,96,96
dart_comment_task_tag=96,96,96
dart_default=0,0,0
dart_doc_default=96,96,96
dart_doc_keyword=96,96,96
dart_doc_link=96,96,96
dart_doc_tag=96,96,96
dart_keyword=0,0,0
dart_keyword_return=0,0,0
dart_multi_line_comment=96,96,96
dart_multiline_string=103,155,59
dart_operator=0,0,0
dart_single_line_comment=122,122,122
dart_string=103,155,59
glanceColorBackground=251,251,200
glanceSelectedColorBackground=182,214,253
pf_coloring_argument=0,0,0
pf_coloring_assignment=0,0,0
pf_coloring_comment=122,122,122
pf_coloring_key=0,0,0
pf_coloring_value=103,155,59
semanticHighlighting.annotation.color=0,0,0
semanticHighlighting.annotation.enabled=true
semanticHighlighting.builtin.bold=true
semanticHighlighting.builtin.color=0,0,0
semanticHighlighting.builtin.enabled=true
semanticHighlighting.class.color=6,70,167
semanticHighlighting.class.enabled=true
semanticHighlighting.constructor.color=6,70,167
semanticHighlighting.constructor.enabled=true
semanticHighlighting.deprecated.color=0,0,0
semanticHighlighting.deprecated.enabled=true
semanticHighlighting.directive.bold=true
semanticHighlighting.directive.color=1,77,100
semanticHighlighting.directive.enabled=true
semanticHighlighting.dynamicType.color=0,0,0
semanticHighlighting.dynamicType.enabled=true
semanticHighlighting.field.color=135,49,46
semanticHighlighting.field.enabled=true
semanticHighlighting.function.color=0,0,0
semanticHighlighting.function.enabled=true
semanticHighlighting.functionTypeAlias.color=6,70,167
semanticHighlighting.functionTypeAlias.enabled=true
semanticHighlighting.getterDeclaration.color=135,49,46
semanticHighlighting.getterDeclaration.enabled=true
semanticHighlighting.importPrefix.color=0,0,0
semanticHighlighting.importPrefix.enabled=true
semanticHighlighting.inheritedMethodInvocation.color=0,0,0
semanticHighlighting.inheritedMethodInvocation.enabled=true
semanticHighlighting.localVariable.color=0,0,0
semanticHighlighting.localVariable.enabled=true
semanticHighlighting.localVariableDeclaration.color=0,0,0
semanticHighlighting.localVariableDeclaration.enabled=true
semanticHighlighting.method.color=0,0,0
semanticHighlighting.method.enabled=true
semanticHighlighting.methodDeclarationName.bold=true
semanticHighlighting.methodDeclarationName.color=11,91,210
semanticHighlighting.methodDeclarationName.enabled=true
semanticHighlighting.number.color=0,0,0
semanticHighlighting.number.enabled=true
semanticHighlighting.parameterVariable.color=135,49,46
semanticHighlighting.parameterVariable.enabled=true
semanticHighlighting.setterDeclaration.color=135,49,46
semanticHighlighting.setterDeclaration.enabled=true
semanticHighlighting.staticField.color=135,49,46
semanticHighlighting.staticField.enabled=true
semanticHighlighting.staticFinalField.color=85,18,42
semanticHighlighting.staticFinalField.enabled=true
semanticHighlighting.staticMethod.color=0,0,0
semanticHighlighting.staticMethod.enabled=true
semanticHighlighting.staticMethodDeclarationName.bold=true
semanticHighlighting.staticMethodDeclarationName.color=11,91,210
semanticHighlighting.staticMethodDeclarationName.enabled=true
semanticHighlighting.typeArgument.color=3,49,120
semanticHighlighting.typeArgument.enabled=true
semanticHighlighting.typeParameter.color=3,49,120
semanticHighlighting.typeParameter.enabled=true
sourceHoverBackgroundColor=251,251,200
This will change the appearance of every Dart source file you open in Eclipse. Then, you can change the colors as you wish.
It's better than that eye-stinging and ugly purple default Eclipse theme... (in my opinion)
Based on this issue I'm guessing this probably isn't possible right now :-/

Emacs auto-complete via ELPA

I've just installed via elpa auto-complete 1.4 and I can see the directory in my .emacs.d/elpa/ folder. Now what do I do? I've tried various .emacs lines, but I'm never sure what an elpa install really does and what I would still need to do to my .emacs file. AFA Emacs is concerned, it can't find auto-complete. I saw this on another install:
(add-to-list 'load-path "~/.emacs.d")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/memyselfi/.emacs.d/ac-dict")
(ac-config-default)
(add-to-list 'ac-modes 'lisp-mode)
(require 'auto-complete)
. . . but this doesn't work. Actually, I'd like auto-complete to do the advance guess/autocomplete in the minibuffer, as when it suggests files, commands, etc.
auto-complete does not do fuzzy matching in the minibuffer.
You probably want to enable ido-mode.
Try putting this in your init.el
(ido-mode t) ;; auto-completes file-names etc
(setq ido-enable-flex-matching t) ;; enables fuzzy matching
There are other packages that do this, but ido-mode comes standard with Emacs, so is probably easiest to get going.

What do I need to put in .emacs to print to default Windows printer?

I used to have postcript printing working perfectly in Emacs 21 in Windows+Cygwin, but after upgrading to Emacs 23, I am receiving the following error in the minibuffer:
Opening output file: invalid argument, C:/PDFCreator:
My current .emacs contain the current relevant statements:
(require 'ps-print)
(setq ps-spool-duplex t)
(setq ps-auto-font-detect nil)
(setq ps-print-color-p nil)
It used to have the following line as well:
(setq ps-lpr-command "qprt")
But it generates a similar error:
Searching for program: no such file or directory, qprt
Any idea what changed in Emacs 23 and how I can bring printing back to life?
(at this point I am only interested in printing to the default Windows printer, which is PDFCreator).
From the Emacs Wiki PrintingFromEmacs, the following configuration is recommended.
Where lpr is the Cygwin lpr version.
(setenv "PRINTER" "PDFCreator")
(cond ((eq system-type 'windows-nt)
(setq ps-printer-name "PDFCreator")
(setq ps-printer-name-option "-d")
(setq ps-lpr-command "/bin/lpr")))
You could also use the Ghostscript configuration there and select the PDFCreator printer from the popup. Adjusting your GS_LIB and your ghostscript binary location accordingly.
(setenv "GS_LIB" "e:/tools/GSTools/gs8.14/gs8.14/lib;e:/tools/GSTools/gs8.14/fonts")
(setq ps-lpr-command "e:/tools/GSTools/gs8.14/gs8.14/bin/gswin32c.exe")
(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"))
(setq ps-printer-name t)
Note to users of PDFCreator - they now install a bunch of toolbars and take over your web browsers when you install it.
http://en.wikipedia.org/wiki/Pdfcreator#Adware_toolbar_controversy
I had PDFCreator working fine with Emacs, then I made the mistake of letting PDFCreator update itself. It redirected all my search queries to Bing, took over a bunch of browser settings, added toolbars, default landing pages etc. It took me about an hour to clean out all the junk it added.
I had the same symtom as the poster, but it wasn't because of any change in Emacs 23.
My printer is a postscript capable network printer.
First, my hostname had changed sligtly when my work computer was upgraded from Windows to Vista. I had to change one character accordingly:
From
(setq ps-printer-name "//evf4ce46ac4ad3/seki81050470cm")
to
(setq ps-printer-name "//e7f4ce46ac4ad3/seki81050470cm")
This changed the error message from
direct-print-region-helper: Opening output file: invalid argument, //evf4ce46ac4ad3/seki81050470cm
to
direct-print-region-helper: Opening output file: no such file or directory, //e7f4ce46ac4ad3/seki81050470cm
Then I had to enable sharing of the printer. This is found in
\\e7f4ce46ac4ad3\Printers
which probably can be found in a more generic way. \\%computername%\Printers didn't work for me; I don't know why.
Right-click on the printer icon, select Sharing and enable Share this printer, with a suitable printer name, preferably with no spaces in it.
This was enough to enable printing for me.

Help in using OpenCV - Errors of type: identifier not found

Am a beginner to OpenCV and have gone so far as to work out the hello world samples, inverting, color conversion(RGB->greyscale ) etc programs working.
However i am stuck at the Programs that use cvCanny, cvPyr and other such feature detectors.Would really be thankful if the tiny prblem was sorted out .
I get the Error: error C3861: 'cvPyrDown': identifier not found
error C3861: 'cvCanny': identifier not found
I've included the imgproc and features2d headers yet the problem persists.
What am I missing out ?
Do you have your "Additional input directories" property set correctly?
Mine, configured by cmake, looks like this:
C:/OpenCV-2.2.0/release
C:/OpenCV-2.2.0/include
C:/OpenCV-2.2.0/include/opencv
C:/OpenCV-2.2.0/modules/core/include
C:/OpenCV-2.2.0/modules/imgproc/include
C:/OpenCV-2.2.0/modules/features2d/include
C:/OpenCV-2.2.0/modules/gpu/include
C:/OpenCV-2.2.0/modules/calib3d/include
C:/OpenCV-2.2.0/modules/objdetect/include
C:/OpenCV-2.2.0/modules/video/include
C:/OpenCV-2.2.0/modules/highgui/include
C:/OpenCV-2.2.0/modules/ml/include
C:/OpenCV-2.2.0/modules/legacy/include
C:/OpenCV-2.2.0/modules/contrib/include
C:/OpenCV-2.2.0/modules/flann/include
Btw. CMake is a nice tool if you are dealing with libraries that contains many include files, line OpenCV.
You can also check two other things:
After compiling OpenCV2.2 from sources, did you built "INSTALL" project in the OpenCV VS solution?
If you are using c++ headers, you might prefer c++ version of those functions,
in the cv namespace:
cv::Canny(...)
That sounds like a link error rather than any problems with include. Are you sure you are linking with cv.lib?
You need to add the $(OPENCV_ROOT)/lib directory to the linker path so it knows where to search for the files.
From the description, I assume you're using Visual Studio? If so, you have two options for doing so.
Add it to this project under Project -> Properties -> Linker -> General -> Additional Library Directories.
Add it for all projects: Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library files. And then add folders there.

Resources