12

Evil has the evil-define-key macro for defining commands for certain states in a specific keymap only: (evil-define-key 'insert emacs-lisp-mode-map (kbd "C-c C-c") 'butterfly (kbd "<pause>") 'zone) It is able to delay the execution of the binding (by using eval-after-load itself) and can also take more ...


7

The function cl-macroexpand-all has been obsoleted in Emacs 24.3; you are now supposed to use macroexpand-all instead, which is part of core Emacs, not the CL library. The CL library defines cl-macroexpand-all as an alias for macroexpand-all, so in principle you could do (require 'cl) in your init file to fix the problem. However, the cl library itself ...


6

Edit: In the past few months I've started using the php-language-server with lsp-mode (which are both components built on Microsoft's Language Server Protocol). It's not a perfect answer yet, but I have jump-to-definition that's working pretty solidly in a large, old PHP codebase, and that alone is worth quite a bit. Other components like docstring/function ...


4

It's bug #18845 in Emacs-24.4. To work around it, you need to add (require 'cl) somewhere before you load php-mode.


2

You can add an entry specifically for config.php into auto-mode-alist, as follows: (add-to-list 'auto-mode-alist (cons (rx bos "config.php" eos) 'php-mode)) (Where bos and eos are shortcuts for string-start and string-end, abbreviated from Beginning/End Of String.)


2

I'm no expert in this, but taking a quick look at the code I say it's regular expressions. Web-mode seems to use regexes to search for <?|<?php tags, then it knows what comes further is php code. The same goes for html, asp, javascript and other languages. I think you should look at the code yourself (M-x describe-function web-mode). And if you're ...


2

Instead of php-mode you can try web-mode. It supports php very well and seemed to indent correctly your example. Edit: In order to make flycheck parses php, add the following to your web-mode-hook: (flycheck-mode 1) (flycheck-add-mode 'php 'web-mode)


2

You only need php-extras-company and company-dabbrev, place them in the same group and at the BEGINNING of the company-backends, (add-hook 'php-mode-hook (lambda () (set (make-local-variable 'company-backends) '((php-extras-company company-dabbrev) company-capf company-files)))) See https://github.com/company-...


2

ob-php is now in Org mode contrib and available through the org-plus-contrib package in Org ELPA. You can install this package by adding Org ELPA to your package-archives list in your init file: (require 'package) (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) Then you can install the org-plus-contrib package by opening the ...


2

This code in .emacs did the job: (add-hook 'php-mode-hook (lambda () (make-local-variable 'c-basic-offset) (setq c-basic-offset 2))) I failed previously because I tried to change the global c-basic-offset. That didn't help as the local variable generated in php-mode took precedence (I think).


1

Just guessing here because I can't replicate the issue, but do the following slightly different functions work? (defun my/indent-region-left-tab () (interactive) (let ((c-syntactic-indentation nil)) (indent-rigidly (region-beginning) (region-end) -4)) (setq deactivate-mark nil)) (defun my/indent-region-right-tab () (interactive) (let ((c-...


1

If the lineup function my-php-lineup-arglist-cont below is registered for the indentation of arglist-cont it fetches the indentation of the preceeding function statement and adds one times c-basic-offset. Use my-php-lineup-arglist-cont as a replacement for php-lineup-cascaded-calls in the entry for arglist-cont-nonempty in your c-offsets-alist. (require '...


1

Here is my code. Yes the documentation is awful for phpactor and it takes some digging. I have this currently and it shows how to use transients and bind them to a key in php-mode. Hopefully useful to someone. (use-package transient :ensure t) (use-package phpactor :ensure t) (use-package company-phpactor :ensure t) (use-package php-mode ...


1

You can customize the indent level of the switch case for PHP like this: (c-set-offset 'case-label 4) This should work for any language that's based on the c-mode.


1

Finally I make it work. The main problem is that org-mode shell source blocks do not capture stderr. You can read more about this here. So normally you will not see output if one of the test fails. Solution for this is to save code block to temporary file and then running org-babel-sh-command on the file which in case of failure redirect stderr to stdout. I ...


1

The issue is probably caused by your theme, which sets the background color for these syntaxes. The easiest way to check whether that's the case is to put the point on an offending character in the buffer, and typing M-x describe-char. If the cause turns out to be the background color, it will be listed in face properties. The reason why it's visible in HTML ...


1

Don't know about PHP. You can try to search for PHP code formatters and see if it has such function. Here is a simple solution using regular expression. It works for your particular example at least. (defun your-php-array-multiline (b e) "Turn oneline php array to multiline." (interactive "*r") (insert (replace-regexp-in-string (rx (in "[,]")) ...


1

With the current versions of php-mode and org-mode, PHP syntax highlighting in org code blocks happens by default. The version of org-mode in Emacs 26.1 includes this support. For earlier versions of Emacs you can install a newer version of org-mode from its ELPA repository. So if you have at least Emacs 26.1 for php highlighting in org-mode you need to ...


1

w calls geben-where: geben-where is an interactive compiled Lisp function in `geben.el'. (geben-where) Move to the current breaking point. It is also bound to C-cC-l which, from the comments, may be consistent with gud behaviour and bindings.


1

This problem is solved. Thanks to Phil Newton (sodaware) for creating this extension to integrate with PHP_beautifier. This application was released 5 hours ago (on March 28, 2017). I have tried some of my PHP Code, and it works well. This is some gif from when I gave it a try.


1

Following the steps in this answer over at Stack Overflow I was able to fix this by tweaking the underlying c-mode like so: (defun my-php-mode-hook () (c-set-offset 'arglist-cont-nonempty '+)) (add-hook 'php-mode-hook 'my-php-mode-hook)


1

Maybe the solution in the section Indentation of arrays of the emacs wiki php-mode page, or a variation of it, is what you are searching for. Quotation: (add-hook 'php-mode-hook (lambda () (defun ywb-php-lineup-arglist-intro (langelem) (save-excursion (goto-char (cdr langelem)) (vector (+ (current-column) c-basic-offset)))) (defun ywb-...


1

This worked for me: (defun my-php-indent-setup () (c-set-offset 'topmost-intro '+) ; Does not affect <?php (but affects ?>) (c-set-offset 'inclass 0)) ; Gets the inside of class{} back to normal (add-hook 'php-mode-hook 'my-php-indent-setup) Note that the closing tag ?> will not be indented in the same level as <?php does, for ...


1

Ok I was leaning how php-mode handles indentation, and also I looked into php-mode.el: The problem was that (add-hook 'php-mode-hook 'php-enable-symfony2-coding-style) sets: (setq indent-tabs-mode nil fill-column 78 c-indent-comments-syntactically-p t require-final-newline t) ... before (c-set-style "symfony2"), so it is overriding ...


1

If you install php-ext (https://savannah.nongnu.org/projects/php-ext-el/), you will have autocompletion and skeleton templates for many, many php functions: $ cd ~ $ mkdir mydir $ cd mydir $ git clone git://git.savannah.nongnu.org/php-ext-el.git Edit you .emacs and add: (setq php-ext-path "~/mydir") (load (concat php-ext-path "php-ext.el"))


Only top voted, non community-wiki answers of a minimum length are eligible